<template>
	<view :style="colorStyle">
		<view class="w-full relative z-99 gradient-box"
			  :style="{ 'padding-top': sysHeight + 'px' }">
			<!-- #ifdef MP -->
			<view class="w-full px-20 pl-20 h-80 flex-between-center">
				<!-- #ifndef MP-ALIPAY -->
				<text class="iconfont icon-ic_leftarrow fs-40 text&#45;&#45;w111-fff"
					  @click="goPage(3)"></text>
				<!-- #endif -->
				<!-- #ifdef MP-ALIPAY -->
				<text></text>
				<!-- #endif -->
				<text class="fs-34 fw-500 text--w111-fff">提交订单</text>
				<text></text>
			</view>
			<!-- #endif -->
			<view class="header"
				  v-if="tableId">
				<view class="top acea-row row-middle">
					<view class="name">{{ codeData.storeName.storeName }}</view>
					<view class="number"><text class="light">{{ codeData.category.name }}{{ codeData.table_number
					}}</text>号桌</view>
				</view>
				<view>{{ codeData.serial_number }}</view>
			</view>
			<view class="px-20 mt-30"
				  v-if="!tableId">
				<view class="allAddress">
					<!-- isDisplay 支持的配送方式数组 -->
					<!-- store_self_mention 自提开关 -->
					<view class="h-96 relative"
						  v-if="isDisplay.length > 1">
						<view class="w-full abs-lb rd-t-24rpx flex bg--w111-fff fs-26 text--w111-666 fw-400">
							<view class="flex-center w-50p h-76 rd-lt-24rpx z-2"
								  :class="deliveryType == 1 ? 'bg--w111-fff font-num fs-28 fw-500' : 'bg-primary-light bg-horn'"
								  v-if="isDisplay.includes('1')"
								  @tap="addressType(0, 1)">快递配送</view>
							<view class="flex-center w-50p h-76 z-2"
								  :class="[deliveryType == 2 ? 'bg--w111-fff font-num fs-28 fw-500' : 'bg-primary-light', styleType]"
								  v-if="isDisplay.includes('2')"
								  @tap="addressType(1, 2)">到店自提</view>
							<view class="flex-center w-50p h-76 rd-rt-24rpx z-2"
								  :class="deliveryType == 3 ? 'bg--w111-fff font-num fs-28 fw-500' : 'bg-primary-light bg-horn-r'"
								  v-if="isDisplay.includes('3')"
								  @tap="addressType(0, 3)">门店发货</view>
						</view>
						<!-- 选中放大样式 2项的-->
						<view v-if="isDisplay.length == 2"
							  class="w-50p rd-t-24rpx bg--w111-fff h-96"
							  :class="(deliveryType == 1 || (deliveryType == 2 && !isDisplay.includes('1'))) ? 'abs-lt' : 'abs-rt'">
							<view class="w-full h-full relative active-card"></view>
						</view>
						<!-- 选中放大样式 3项的-->
						<view v-if="isDisplay.length == 3"
							  class="w-33-33p rd-t-24rpx bg--w111-fff h-96"
							  :class="deliveryType == 1 ? 'abs-lt' : deliveryType == 2 ? 'abs-ct' : 'abs-rt'">
							<view class="w-full h-full relative active-card"></view>
						</view>
					</view>
					<view v-else
						  class="bg--w111-fff rd-t-24rpx text--w111-999 fs-24">
						<view v-if="Array.isArray(isDisplay) && isDisplay.includes('1')"
							  class="acea-row row-middle h-88 lh-88rpx ml-34 mr-34 border-b b--w111-f5f5f5 border-b-s">
							<text class="iconfont icon-icon_truck font-num fs-36 mr-12"></text>
							<text class="font-num fs-28 mr-12">快递发货</text> 线上下单，商城发货
						</view>
						<view v-else-if="Array.isArray(isDisplay) && isDisplay.includes('2')"
							  class="acea-row row-middle h-88 lh-88rpx ml-34 mr-34 border-b b--w111-f5f5f5 border-b-s">
							<text class="iconfont icon-a-icon_trailcar font-num fs-36 mr-12"></text>
							<text class="font-num fs-28 mr-12">到店自提</text> 线上下单，到店自提
						</view>
						<view v-else
							  class="acea-row row-middle h-88 lh-88rpx ml-34 mr-34 border-b b--w111-f5f5f5 border-b-s">
							<text class="iconfont icon-icon_truck font-num fs-36 mr-12"></text>
							<text class="font-num fs-28 mr-12">门店发货</text> 线上下单，门店发货
						</view>
					</view>
					<view class='address add1 flex-between-center'
						  :class="[1, 2].includes(isDisplay) ? 'rd-24rpx' : 'rd-b-24rpx'"
						  @tap='onAddress(addressInfo.real_name)'
						  v-if='deliveryType == 1'>
						<view v-if="addressInfo.real_name">
							<view class="fs-30 text--w111-333 fw-500 acea-row row-middle">
								<text>{{ addressInfo.real_name }}</text> <text class='pl-20'>{{ addressInfo.phone
								}}</text>
								<text class='default font-num acea-row row-center-wrapper ml-8'
									  v-if="addressInfo.is_default">默认</text>
							</view>
							<view class="fs-24 text--w111-666 mt-12"> {{ addressInfo.province }}{{ addressInfo.city }}{{
								addressInfo.district }}{{ addressInfo.street }}{{ addressInfo.detail }} </view>
						</view>
						<view class='fs-30 text--w111-333 fw-500 lh-42rpx flex-y-center'
							  v-else>
							<image src="../static/location_order_icon.png"
								   class="w-32 h-32"></image>
							<text class="pl-8">设置收货地址</text>
						</view>
						<text class="iconfont icon-ic_rightarrow fs-32 text--w111-666 ml-20"></text>
					</view>
					<view class='address add1 acea-row row-between-wrapper'
						  :class="[1, 2].includes(isDisplay) ? 'rd-24rpx' : 'rd-b-24rpx'"
						  v-else>
						<block v-if="storeList.length > 0">
							<view class="w-full">
								<view class="w-full flex-between-center">
									<view @click="goStore">
										<view class="fs-30 line1 fw-500 lh-42rpx acea-row row-middle">
											<text class="line1 max-w-368">{{ system_store.name }}</text>
											<text class="iconfont icon-ic_rightarrow ml-12"
												  v-if="!collage_id && !isStore"></text>
										</view>
										<view class="fs-24 w-410 line2 text--w111-666 lh-30rpx mt-12"> {{
											system_store.address }}{{ system_store.detailed_address }}</view>
									</view>
									<view class="_map relative"
										  :style="{ backgroundImage: 'url(' + imgHost + '/statics/images/order/order_map_bg.png' + ')' }"
										  @tap="showMaoLocation(system_store)">
										<view
											  class="store_distance flex-center bg--w111-fff rd-8rpx fs-20 fw-500 line1">
											距您{{ range }}km</view>
										<view class="store-horn"></view>
										<view class="store_logo bg--w111-fff rd-8rpx">
											<image class="w-full h-full rd-8rpx relative z-2"
												   :src="site_logo"></image>
										</view>
										<view class="store-spot"></view>
									</view>
								</view>
							</view>
						</block>
						<block v-else>
							<view>暂无门店信息</view>
						</block>
					</view>
					<view class='line'>
						<image src='/static/images/line.jpg'></image>
					</view>
					<!--          预计送达时间-->
					<view v-if="deliveryType != 2"
						  class="plan-time mt-10 rd-24rpx flex-between-center p-20 fs-26">
						<view class="l text--w111-666">预计送达时间</view>
						<view v-if="expressInfo.time && addressId"
							  class="r flex-y-center">
							<view v-if="expressInfo.express.includes('顺丰')"
								  class="ebao-color ebao-shunfeng mr-20 fs-52"></view>
							<view>
								<view class="time">{{ expressInfo.time }}</view>
								<view class="exp">{{ expressInfo.express }}</view>
							</view>
						</view>
						<view v-else
							  class="express-tip"
							  @click="getExpressTime('btn')"> 查看时间 </view>
					</view>
				</view>
			</view>
		</view>
		<!--		<view class="address flex-1 ml-20 mr-20 rd-16rpx mt-20 p-32 border-top" v-if="deliveryType == 2 && !tableId">-->
		<!--			<view class="flex">-->
		<!--				<view class="flex-1">-->
		<!--					<view class="fs-24 text&#45;&#45;w111-999 lh-34rpx">我的姓名</view>-->
		<!--					<view class="flex-y-center mt-6">-->
		<!--						<input type="text" v-model="contacts" :focus="contactsFocus" class="w-78 h-36 fs-26 fw-500 lh-36rpx" />-->
		<!--						<text class="iconfont icon-ic_edit fs-28 text&#45;&#45;w111-999 pl-16" @tap="clearInput(0)"></text>-->
		<!--					</view>-->
		<!--				</view>-->
		<!--				<view class="pl-46 flex-1">-->
		<!--					<view class="fs-24 text&#45;&#45;w111-999 lh-34rpx">我的电话</view>-->
		<!--					<view class="flex-y-center mt-6">-->
		<!--						<input type="number" v-model="contactsTel" :focus="telFocus" class="w-222 h-36 fs-30 fw-500 lh-30rpx SemiBold" />-->
		<!--						<text class="iconfont icon-ic_edit fs-28 text&#45;&#45;w111-999 pl-16" @tap="clearInput(1)"></text>-->
		<!--					</view>-->
		<!--				</view>-->
		<!--			</view>-->
		<!--		</view>-->
		<!-- v-if='(deliveryType == 3 || deliveryType == 2) && !tableId'   10-28-->
		<view class='address add1 flex-between-center ml-20 mr-20 rd-16rpx mt-20'
			  @tap='onAddress(addressInfo.real_name)'
			  v-if='deliveryType == 3 && !tableId'>
			<view v-if="addressInfo.real_name">
				<view class="fs-30 text--w111-333 fw-500 acea-row row-middle">
					<text>{{ addressInfo.real_name }}</text> <text class='pl-20'>{{ addressInfo.phone }}</text>
					<text class='default font-num acea-row row-center-wrapper ml-8'
						  v-if="addressInfo.is_default">默认</text>
				</view>
				<view class="fs-24 text--w111-666 mt-12"> {{ addressInfo.province }}{{ addressInfo.city }}{{
					addressInfo.district }}{{ addressInfo.street }}{{ addressInfo.detail }} </view>
			</view>
			<view class='fs-30 text--w111-333 fw-500 lh-42rpx flex-y-center'
				  v-else>
				<image src="../static/location_order_icon.png"
					   class="w-32 h-32"></image>
				<text class="pl-8">设置收货地址</text>
			</view>
			<text class="iconfont icon-ic_rightarrow fs-32 text--w111-666 ml-20"></text>
		</view>
		<view class='order-submission'>
			<view class="px-20 mt-20"
				  style="margin-bottom: 100rpx">
				<groupGoodsList :goodsList="goodsList"
								v-if="collage_id"></groupGoodsList>
				<view class="bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32"
					  v-else>
					<view class="flex order_goods"
						  v-for="(item, index) in cartInfo"
						  :key="index">
						<view class="w-176 h-176 relative">
							<image class="w-176 h-176 rd-16rpx"
								   :src='item.productInfo.attrInfo.image'
								   v-if="item.productInfo.attrInfo"></image>
							<image class="w-176 h-176 rd-16rpx"
								   :src='item.productInfo.image'
								   v-else></image>
							<view class="over flex-center fs-24 text--w111-fff"
								  v-if="!item.is_valid">{{ shippingType == 1 ? '非自提' : '不送达' }}</view>
						</view>
						<view class="flex-1 flex-col justify-between pl-20">
							<view @click="goDetail(item.product_id)">
								<view class="w-464 line2 fs-28 lh-40rpx"
									  :class="item.is_valid ? 'text--w111-333' : 'text--w111-ccc'">
									<secondHandTag :lease_type="item.productInfo.lease_type"
												   :new_old="item.productInfo.new_old"
												   :level="item.productInfo.level"></secondHandTag> {{
													item.productInfo.store_name }}
								</view>
								<view class='w-322 fs-22 lh-30rpx line1 mt-12'
									  :class="item.is_valid ? 'text--w111-999' : 'text--w111-ccc'"
									  v-if="item.productInfo.attrInfo">{{ item.productInfo.attrInfo.suk_alias }}</view>
								<!--								<view class="flex items-end flex-wrap mt-12 w-full">-->
								<!--									<BaseTag-->
								<!--										:text="label.label_name"-->
								<!--										:color="label.color"-->
								<!--										:background="label.bg_color"-->
								<!--										:borderColor="label.border_color"-->
								<!--										:circle="label.border_color ? true : false"-->
								<!--										:imgSrc="label.icon"-->
								<!--										v-for="(label, idx) in item.productInfo.store_label" :key="idx"></BaseTag>-->
								<!--								</view>-->
							</view>
							<view class="flex-between-center">
								<!-- 总租金 -->
								<!--								<baseMoney :money="priceGroup.totalPrice" symbolSize="20" integerSize="36" decimalSize="20" :color="item.is_valid ? '#333' : '#cccccc' " weight></baseMoney>-->
								<!-- 商城订单，可编辑数量 -->
								<!--                <view v-if="orderGoodsType==='mall'">-->
								<!--                  <view class="flex-y-center" v-if="[0,6].includes(goodsType) && item.is_valid">-->
								<!--                    <text class="iconfont icon-ic_Reduce fs-24"-->
								<!--                          :class="item.cart_num > 1 ? 'text&#45;&#45;w111-333' : 'text&#45;&#45;w111-999'"-->
								<!--                          @click.stop="addCart(0,item)"></text>-->
								<!--                    <input type="number" maxlength="3"-->
								<!--                           class="w-72 h-36 rd-4rpx bg&#45;&#45;w111-f5f5f5 flex-center text-center fs-24 text&#45;&#45;w111-333 mx-6"-->
								<!--                           @input="setValue($event,item)" v-model="item.cart_num"/>-->
								<!--                    <text class="iconfont icon-ic_increase fs-24 text&#45;&#45;w111-333" @click.stop="addCart(1,item)"></text>-->
								<!--                  </view>-->
								<!--                  <view v-if="![0,6].includes(goodsType)">-->
								<!--                    <text class="fs-28 text&#45;&#45;w111-666">️x{{ item.cart_num }}</text>-->
								<!--                  </view>-->
								<!--                </view>-->
								<!--                &lt;!&ndash; 租赁订单，不可编辑数量 &ndash;&gt;-->
								<!--                <view v-if="orderGoodsType==='lease'">-->
								<!--                  <text class="fs-28 text&#45;&#45;w111-666">️x{{ item.cart_num }}</text>-->
								<!--                </view>-->
							</view>
						</view>
					</view>
					<view class="cell flex justify-between mt-32"
						  v-if="giftCount > 0">
						<text class="text--w111-333 fs-28">赠品</text>
						<view class="w-460 flex-y-center justify-end"
							  @tap="showGiftDrawer = true">
							<view class="flex">
								<view class="w-64 h-64 mr-8"
									  v-for="(item, index) in giveCartInfo"
									  :key="index">
									<image class="h-full w-full rd-8rpx"
										   :src="item.productInfo.attrInfo.image"
										   v-if="item.productInfo.attrInfo"></image>
									<image class="h-full w-full rd-8rpx"
										   :src="item.productInfo.image"
										   v-else></image>
								</view>
								<view class="w-64 h-64 rd-8rpx bg--w111-f5f5f5 flex-center mr-8"
									  v-if="giveData.give_coupon.length">
									<text class="gold iconfont icon-a-ic_discount1"></text>
								</view>
								<view class="w-64 h-64 rd-8rpx bg--w111-f5f5f5 flex-center mr-8"
									  v-if="giveData.give_integral > 0">
									<text class="gold iconfont icon-ic_badge11"></text>
								</view>
							</view>
							<view class="fs-26 text--w111-666">共{{ giftCount }}件 <text
									  class="iconfont icon-ic_rightarrow"></text> </view>
						</view>
					</view>
					<view class="cell flex justify-between flex-y-center mt-32"
						  v-if="textareaStatus">
						<text class="text--w111-333 fs-28">留言</text>
						<textarea class="w-450 fs-28 text-right h-auto"
								  :show-count="false"
								  :auto-height="true"
								  wrap-style="wrap"
								  max-height="100px"
								  placeholder-class='placeholder'
								  placeholder="请先与商家沟通一致再留言哦～"
								  :always-embed="true"
								  :adjust-position="true"
								  cursor-spacing="30"
								  v-if="!coupon.coupon"
								  @input='bindHideKeyboard'
								  :value="mark"
								  :maxlength="150"
								  name="mark">
						</textarea>
					</view>
				</view>
				<!--        租期范围-->
				<view v-if="orderGoodsType === 'lease' && expressInfo.time"
					  class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32 fs-28 text--w111-333">
					<view class="lease-area">
						<view class="time fs-26 flex-between-center">
							<view class="l">
								<view class="tag">租</view>
								<view class="txt">{{ leaseTime.start }}</view>
							</view>
							<view class="c fs-24 fw-bold relative">
								<view class="c-line-l"></view>
								<view class="c-day">共{{ leaseTime.duration }}天</view>
								<view class="c-line-r"></view>
							</view>
							<view class="r">
								<view class="tag tag2">还</view>
								<view class="txt txt2">{{ leaseTime.end }}</view>
							</view>
						</view>
						<view class="tip mt-16 fs-24 text--w111-999">快递期间不算租期，实际起租日以快递签收日为准</view>
					</view>
				</view>
				<!-- 租赁信息（商城也显示增值服务） -->
				<view v-if="orderGoodsType === 'lease' || priceGroup.addServicePrice != 0"
					  class="mt-20 relative bg--w111-fff rd-16rpx pt-100rpx pr-24 pl-24 pb-32 fs-28 text--w111-333 overflow"
					  style="border:1rpx solid #fff;">
					<view class="first-pay cell flex-between-center"
						  v-if="orderGoodsType === 'lease'">
						<text class="fs-32 fw-bold">首期实付租金</text>
						<view @click="firstPop.show = true">
							<!--              <text class="fs-20 fw-500">￥</text>-->
							<!--              <text class="fs-40 fw-bold Regular">{{ totalPrice }}</text>-->
							<baseMoney :money="totalPrice || 0"
									   symbolSize="26"
									   integerSize="44"
									   decimalSize="26"
									   weight></baseMoney>
							<text class="iconfont icon-ic_rightarrow fs-24"></text>
						</view>
					</view>
					<!-- 只有一期则不显示 -->
					<view class="cell flex-between-center"
						  v-if="orderGoodsType === 'lease' && priceGroup.rent !== 0">
						<text>剩余租期</text>
						<view @click="instal.show = true"
							  class="flex-y-center">
							<text class="fs-30 fw-bold Regular">
								<!--0元随心租-->
								<text class="mr-10"
									  v-if="is_super"><text class="fs-20 fw-500">￥</text>0</text>
								<!--                真实价格-->
								<text class="fs-20 fw-500"
									  :class="{ 'line-money': is_super }">￥</text>
								<text :class="{ 'line-money': is_super }">{{ priceGroup.rent }}</text>
								<text class="px-6"> x </text>
								<text>{{ priceGroup.rent_num }}</text>
							</text>
							<text class="fs-26 fw-bold">期</text>
							<text class="iconfont icon-ic_rightarrow fs-24"></text>
						</view>
					</view>
					<!--          <view class="cell flex-between-center" v-if="orderGoodsType==='lease'">-->
					<!--            <text>首期租金</text>-->
					<!--            <view>-->
					<!--              <text class="fs-20 fw-500">￥</text>-->
					<!--              <text class="fs-30 fw-bold Regular">{{priceGroup.first_rent}}</text>-->
					<!--            </view>-->
					<!--          </view>-->
					<view class="cell flex-between-center text--w111-333"
						  v-if="orderGoodsType === 'lease'">
						<text>总租金</text>
						<view>
							<!--0元随心租-->
							<text v-if="is_super"
								  class="fs-20 fw-500">￥</text>
							<text v-if="is_super"
								  class="fs-30 fw-bold Regular mr-10">0</text>
							<text :class="{ 'line-money': is_super }"
								  class="fs-20 fw-500">￥</text>
							<text :class="{ 'line-money': is_super }"
								  class="fs-30 fw-bold Regular">{{ priceGroup.totalPrice }}</text>
						</view>
					</view>
					<view class="cell flex-between-center"
						  v-if="orderGoodsType === 'lease' && priceGroup.deposit != 0">
						<text>押金</text>
						<view>
							<text :class="{ 'line-money': is_super }"
								  class="fs-20 fw-500">￥</text>
							<text :class="{ 'line-money': is_super }"
								  class="fs-30 fw-bold Regular"> {{ priceGroup.deposit }} </text>
							<!--0元随心租-->
							<text v-if="is_super"
								  class="fs-20 fw-500">￥</text>
							<text v-if="is_super"
								  class="fs-30 fw-bold Regular"> 0 </text>
						</view>
					</view>
					<view class="cell flex-between-center"
						  v-if="!is_super && orderGoodsType === 'lease' && buyout_money_end > 0">
						<text>到期买断尾款</text>
						<view>
							<text class="fs-20 fw-500">￥</text>
							<!--              <text class="fs-30 fw-bold Regular">{{priceGroup.buyout_money}}</text>-->
							<text class="fs-30 fw-bold Regular">{{ buyout_money_end }}</text>
						</view>
					</view>
					<view class="cell flex-between-center"
						  v-if="coupon_price > 0">
						<text>优惠券抵扣</text>
						<text class="text--w111-333 fs-30 Regular font-num">-￥{{ parseFloat(coupon_price).toFixed(2)
						}}</text>
					</view>
				</view>
				<!--        增值服务-->
				<view v-if="orderGoodsType === 'lease' && (priceGroup.addServicePrice != 0 || priceGroup.related && priceGroup.related.length > 0)"
					  class="add-wrap mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
					<view class="cell flex-between-center collapse-box"
						  v-if="priceGroup.addServicePrice != 0"
						  style="align-items: flex-start">
						<text class="white-nowrap">增值服务</text>
						<view class="pl-56">
							<uni-collapse ref="collapse"
										  class="collapse-box1">
								<uni-collapse-item title-border="none">
									<template v-slot:title>
										<view>
											<text class="fs-20 fw-500">￥</text>
											<text class="fs-30 fw-bold Regular">{{ priceGroup.addServicePrice }}</text>
										</view>
									</template>
									<view class="content">
										<view v-for="(item, index) in priceGroup.addService"
											  :key="index"
											  class="mb-4"> {{ item.name }} &nbsp; <text class="fs-20 fw-500">￥</text>
											<text class="fs-24 fw-bold Regular">{{ item.price }}</text>
										</view>
									</view>
								</uni-collapse-item>
							</uni-collapse>
						</view>
					</view>
					<view v-if="priceGroup.related && priceGroup.related.length > 0"
						  class="cell flex-between-center"
						  style="align-items: flex-start">
						<text class="white-nowrap">卡项权益</text>
						<view class="pl-56 card-item">
							<view class="price mb-10">
								<text class="fs-20 fw-500">￥</text>
								<text class="fs-30 fw-bold Regular">{{ priceGroup.cardAmount }}</text>
							</view>
						</view>
					</view>
					<view class="card-listn listn"
						  v-if="priceGroup.related && priceGroup.related.length > 0">
						<view class="card-itemn itemn rd-28rpx b-ff"
							  v-for="(item, index) in priceGroup.related"
							  :key="index">
							<image class="l"
								   mode="aspectFill"
								   :src="item.image"></image>
							<view class="r">
								<view class="r-1 line1">{{ item.card_name }}</view>
								<view class="r-2 ">￥{{ item.price }}</view>
							</view>
						</view>
					</view>
				</view>
				<view v-if="orderGoodsType === 'lease' && !is_super"
					  class="zhima-wrap mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
					<view class="zhima-wrap-tit">选择押金支付方式</view>
					<view v-if="system_lease_check_type == depositType.all"
						  class="zhima-wrap-main">
						<view :class="['l', { 'check': zhimaCheck == depositType.zhima }]"
							  @click="zhimaCheck = depositType.zhima">
							<view class="ebao-iconfont ebao-zhimaxinyong"></view>
							<view class="tit flex">
								<view>芝麻信用</view>
								<view class="mr-10 ml-10">|</view>
								<view>免押金</view>
							</view>
							<view class="zhima-tip">芝麻分≥550可享</view>
							<view class="top-tip">最高全免</view>
						</view>
						<view :class="['r', { 'check': zhimaCheck == depositType.mayi }]"
							  @click="zhimaCheck = depositType.mayi">
							<view class="ebao-color ebao-a-mayilian1"></view>
							<view>智能风控免押</view>
							<view class="zhima-tip text-red">芝麻信用免押未通过请选择此项</view>
						</view>
					</view>
					<view v-else
						  class="zhima-wrap-main-single">
						<view v-if="system_lease_check_type == depositType.zhima"
							  :class="['zhima-single', { 'check': zhimaCheck == depositType.zhima }]">
							<view class="ebao-iconfont ebao-zhimaxinyong"></view>
							<view class="zhima-single-r">
								<view class="tit flex">
									<view>芝麻信用</view>
									<view class="mr-10 ml-10">|</view>
									<view>免押金</view>
								</view>
								<view class="zhima-tip">芝麻分≥550可享</view>
								<view class="top-tip">最高全免</view>
							</view>
						</view>
						<view v-if="system_lease_check_type == depositType.mayi"
							  :class="['mayi-single', { 'check': zhimaCheck == depositType.mayi }]">
							<view class="ebao-color ebao-a-mayilian1"></view>
							<view class="mayi-single-r">
								<view>智能风控免押</view>
								<view class="zhima-tip text-red">芝麻信用免押未通过请选择此项</view>
							</view>
						</view>
					</view>
					<!--          <view class="zhima-box flex-between-center">-->
					<!--            <view class="l">-->
					<!--              <view class="l-1 flex-y-center">-->
					<!--                <view class="ebao-iconfont ebao-zhimaxinyong"></view>-->
					<!--                <view>芝麻信用</view>-->
					<!--                <view class="mr-10 ml-10">|</view>-->
					<!--                <view>免押金</view>-->
					<!--                <view class="zhima-tip">芝麻分≥600可享</view>-->
					<!--              </view>-->
					<!--              <view class="l-2 mt-14 text&#45;&#45;w111-666 fs-24">-->
					<!--                点击下方“去免押”，授权成功获取免押额度-->
					<!--              </view>-->
					<!--            </view>-->
					<!--          </view>-->
				</view>
				<view class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32"
					  v-if="is_super === 0">
					<view class="cell flex-between-center"
						  v-if="[0, 6, 10].includes(type) && !noCoupon && goodsType != 7 && priceGroup.firstOrderPrice == 0 && is_super === 0"
						  @tap='couponTap'>
						<text class="text--w111-333 fs-28">优惠券</text>
						<view>
							<text class="text--w111-333 fs-26"
								  :class="{ 'text-red fw-bold': couponId }">{{ couponTitle }}</text>
							<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999 pl-8"></text>
						</view>
					</view>
					<view class="cell flex-between-center"
						  v-if="[0, 6, 10].includes(type) && integral_ratio_status == 1 && is_super === 0 && lease_type == 1">
						<text class="text--w111-333 fs-28">里程币抵扣</text>
						<view class="flex-y-center">
							<view> {{ useIntegral ? "剩余里程币" : "当前里程币" }} <text
									  class='Regular font-num fs-36 pl-8 pr-12'>{{ integral || 0 }}</text>
							</view>
							<checkbox-group @change="ChangeIntegral">
								<checkbox :disabled="integral <= 0 && !useIntegral"
										  :checked='useIntegral ? true : false' />
							</checkbox-group>
						</view>
					</view>
					<view class="cell flex-between-center"
						  v-if="(invoice_func || special_invoice) && !tableId"
						  @tap='goInvoice'>
						<text class="text--w111-333 fs-28">开具发票</text>
						<view>
							<text class="text--w111-333 fs-28">{{ invTitle }}</text>
							<text class="iconfont icon-ic_rightarrow fs-24 text--w111-999 pl-8"></text>
						</view>
					</view>
				</view>
				<view class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32"
					  v-if="type == 4">
					<view class="cell flex-between-center">
						<text class="text--w111-333 fs-28">可用里程币</text>
						<text>{{ userInfo.integral }}</text>
					</view>
					<view class="cell flex-between-center">
						<text class="text--w111-333 fs-28">抵扣里程币</text>
						<text>{{ totalIntegral }}</text>
					</view>
				</view>
				<view class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32"
					  v-if="confirm.length">
					<view class="cell flex justify-between"
						  v-for="(item, index) in confirm"
						  :key="index">
						<text class="relative text--w111-333 fs-28"
							  :class="item.titleShow.val ? 'pl-16' : ''">
							<text class="asterisk"
								  v-if="item.titleShow.val">*</text> {{ item.titleConfig.value }} </text>
						<!-- radio -->
						<view v-if="item.name == 'radios'"
							  class="discount">
							<radio-group @change="radioChange(e, index, item)"
										 class="acea-row row-middle row-right">
								<label class="radio"
									   v-for="(j, jindex) in item.wordsConfig.list"
									   :key="jindex">
									<view class="acea-row row-middle">
										<!-- #ifndef MP -->
										<radio :value="jindex.toString()"
											   :checked='j.show' />
										<!-- #endif -->
										<!-- #ifdef MP -->
										<radio :value="jindex"
											   :checked='j.show' />
										<!-- #endif -->
										<view>{{ j.val }}</view>
									</view>
								</label>
							</radio-group>
						</view>
						<!-- checkbox -->
						<view v-if="item.name == 'checkboxs'"
							  class="discount">
							<checkbox-group @change="checkboxChange($event, index, item)"
											class="acea-row row-middle row-right">
								<label class="radio"
									   v-for="(j, jindex) in item.wordsConfig.list"
									   :key="jindex">
									<view class="acea-row row-middle">
										<!-- #ifndef MP -->
										<checkbox :value="jindex.toString()"
												  :checked="j.show"
												  style="transform:scale(0.9)" />
										<!-- #endif -->
										<!-- #ifdef MP -->
										<checkbox :value="jindex"
												  :checked="j.show"
												  style="transform:scale(0.9)" />
										<!-- #endif -->
										<view>{{ j.val }}</view>
									</view>
								</label>
							</checkbox-group>
						</view>
						<!-- text -->
						<view v-if="item.name == 'texts' && item.valConfig.tabVal == 0"
							  class="discount">
							<input type="text"
								   :placeholder="item.tipConfig.value"
								   placeholder-class="placeholder"
								   v-model="item.value" />
						</view>
						<!-- number -->
						<view v-if="item.name == 'texts' && item.valConfig.tabVal == 4"
							  class="discount">
							<input type="number"
								   :placeholder="item.tipConfig.value"
								   placeholder-class="placeholder"
								   v-model="item.value" />
						</view>
						<!-- email -->
						<view v-if="item.name == 'texts' && item.valConfig.tabVal == 3"
							  class="discount">
							<input type="text"
								   :placeholder="item.tipConfig.value"
								   placeholder-class="placeholder"
								   v-model="item.value" />
						</view>
						<!-- data -->
						<view v-if="item.name == 'dates'"
							  class="discount">
							<picker mode="date"
									:value="item.value"
									@change="bindDateChange($event, index)">
								<view class="acea-row row-between-wrapper">
									<view v-if="item.value == ''">{{ item.tipConfig.value }}</view>
									<view v-else>{{ item.value }}</view>
									<text class='iconfont icon-jiantou'></text>
								</view>
							</picker>
						</view>
						<!-- dateranges -->
						<view v-if="item.name == 'dateranges'"
							  class="discount">
							<uni-datetime-picker v-model="item.value"
												 type="daterange"
												 @maskClick="maskClick"> {{ item.value.length ? item.value[0] + ' - ' +
													item.value[1] : item.tipConfig.value }} <text class='iconfont icon-jiantou'></text>
							</uni-datetime-picker>
						</view>
						<!-- time -->
						<view v-if="item.name == 'times'"
							  class="discount">
							<picker mode="time"
									:value="item.value"
									@change="bindTimeChange($event, index)"
									:placeholder="item.tipConfig.value">
								<view class="acea-row row-between-wrapper">
									<view v-if="item.value == ''">{{ item.tipConfig.value }}</view>
									<view v-else>{{ item.value }}</view>
									<text class='iconfont icon-jiantou'></text>
								</view>
							</picker>
						</view>
						<!-- timeranges -->
						<view v-if="item.name == 'timeranges'"
							  class="discount acea-row row-between-wrapper"
							  @click="getTimeranges(index)">
							<view v-if="item.value">{{ item.value }}</view>
							<view v-else>{{ item.tipConfig.value }}</view>
							<text class='iconfont icon-jiantou'></text>
						</view>
						<!-- select -->
						<view v-if="item.name == 'selects'"
							  class="discount">
							<picker :value="item.value"
									:range="item.wordsConfig.list"
									@change="bindSelectChange($event, index, item)"
									range-key="val">
								<view class="acea-row row-between-wrapper">
									<view v-if="item.value == ''">请选择</view>
									<view v-else>{{ item.value }}</view>
									<text class='iconfont icon-jiantou'></text>
								</view>
							</picker>
						</view>
						<!-- city -->
						<view v-if="item.name == 'citys'"
							  class="discount"
							  @click="changeRegion(index)">
							<view class="acea-row row-middle row-right">
								<view class="city"
									  v-if="item.value == ''">{{ item.tipConfig.value }}</view>
								<view class="city"
									  v-else>{{ item.value }}</view>
								<text class='iconfont icon-jiantou'></text>
							</view>
						</view>
						<!-- id -->
						<view v-if="item.name == 'texts' && item.valConfig.tabVal == 2"
							  class="discount">
							<input type="idcard"
								   :placeholder="item.tipConfig.value"
								   placeholder-class="placeholder"
								   v-model="item.value" />
						</view>
						<!-- phone -->
						<view v-if="item.name == 'texts' && item.valConfig.tabVal == 1"
							  class="discount">
							<input type="number"
								   :placeholder="item.tipConfig.value"
								   placeholder-class="placeholder"
								   v-model="item.value" />
						</view>
						<!-- img -->
						<view v-if="item.name == 'uploadPicture'"
							  class="flex-1">
							<view class="flex justify-end"
								  v-if="item.value.length < 3">
								<view class="relative"
									  v-for="(items, indexs) in item.value"
									  :key="indexs">
									<image class="w-128 h-128 rd-12rpx ml-16"
										   :src="items"></image>
									<view class="abs-rt w-32 h-32 bg--w111-bbb clear-btn flex-center fs-24 text--w111-fff"
										  @click="DelPic(index, indexs)">
										<text class="iconfont icon-ic_close"></text>
									</view>
								</view>
								<view class="w-128 h-128 rd-12rpx bg--w111-f5f5f5 flex-col flex-center ml-16"
									  v-if="item.value.length < item.numConfig.val"
									  @tap="uploadpic(index)">
									<text class='iconfont icon-ic_camera fs-40'></text>
									<view class="fs-20 text--w111-333">上传图片</view>
								</view>
							</view>
							<view class="flex justify-end"
								  v-else>
								<scroll-view scroll-x="true"
											 scroll-with-animation
											 class="white-nowrap vertical-middle w-508"
											 show-scrollbar="false">
									<view class="w-full h-full flex">
										<view class="inline-block h-128 mr-12">
											<view class="w-128 h-128 rd-12rpx bg--w111-f5f5f5 ml-16 flex-col flex-center"
												  v-if="item.value.length < item.numConfig.val"
												  @tap="uploadpic(index)">
												<text class='iconfont icon-ic_camera fs-40'></text>
												<view class="fs-20 text--w111-333">上传图片</view>
											</view>
										</view>
										<view class="inline-block mr-12 relative"
											  v-for="(items, indexs) in item.value"
											  :key="index">
											<image class="w-128 h-128 rd-12rpx"
												   :src="items"></image>
											<view class="abs-rt w-32 h-32 bg--w111-bbb rd-rt-12rpx flex-center fs-24 text--w111-fff"
												  @click="DelPic(index, indexs)">
												<text class="iconfont icon-ic_close"></text>
											</view>
										</view>
									</view>
								</scroll-view>
							</view>
						</view>
					</view>
				</view>
				<view class="mt-20 bg--w111-fff rd-16rpx other">
					<!--					<view class="cell flex-between-center">-->
					<!--						<text class="text&#45;&#45;w111-333 fs-28">商品总价</text>-->
					<!--						<text class="text&#45;&#45;w111-333 fs-36 Regular">￥{{priceGroup.sumPrice}}</text>-->
					<!--					</view>-->
					<view class="cell flex-between-center"
						  v-if="priceGroup.firstOrderPrice > 0">
						<text class="text--w111-333 fs-28">新人首单优惠</text>
						<text class="text--w111-333 fs-36 Regular font-num"> -￥{{ priceGroup.firstOrderPrice }}</text>
					</view>
					<view class="cell flex-between-center"
						  v-if="orderGoodsType === 'lease'">
						<text class="text--w111-333 fs-28">配送方式</text>
						<!--  1：快递配送-->
						<text v-if="deliveryType == 1">
							<!-- 包邮：运费为0-->
							<text class="text--w111-333 fs-28 Regular fw-bold"
								  v-if="priceGroup.storePostage === 0"> 寄出包邮 <text class="line-text">|</text> 归还自付
							</text>
							<!-- 运费大于0 -->
							<text class="text--w111-333 fs-28 Regular fw-bold"
								  v-if="priceGroup.storePostage > 0"> 快递发货 </text>
						</text>
						<!--  2：门店配送-->
						<text v-else-if="deliveryType == 2">
							<!-- 运费大于0 -->
							<text class="text--w111-333 fs-28 Regular fw-bold"> 门店自提 </text>
						</text>
						<!--  3：门店配送-->
						<text v-else-if="deliveryType == 3">
							<!-- 运费大于0 -->
							<text class="text--w111-333 fs-28 Regular fw-bold"> 门店配送 </text>
						</text>
					</view>
					<view class="cell flex-between-center"
						  v-if="priceGroup.storePostage > 0">
						<text class="text--w111-333 fs-28">配送运费</text>
						<text class="text--w111-333 fs-36 Regular font-num">￥{{ (parseFloat(priceGroup.storePostage) +
							parseFloat(priceGroup.storePostageDiscount)).toFixed(2) }}</text>
					</view>
					<view class="cell flex-between-center"
						  v-if="priceGroup.vipPrice > 0 && userInfo.vip && [0, 6, 9].includes(type)">
						<text class="text--w111-333 fs-28">用户等级优惠</text>
						<text class="text--w111-333 fs-36 Regular font-num">-￥{{
							parseFloat(priceGroup.vipPrice).toFixed(2) }}</text>
					</view>
					<view class="cell flex-between-center"
						  v-if="priceGroup.storePostageDiscount > 0">
						<text class="text--w111-333 fs-28">会员运费优惠</text>
						<text class="text--w111-333 fs-36 Regular font-num">-￥{{
							parseFloat(priceGroup.storePostageDiscount).toFixed(2) }}</text>
					</view>
					<view class="cell flex-between-center"
						  v-if="integral_price > 0 && lease_type == 1">
						<text class="text--w111-333 fs-28">里程币抵扣</text>
						<text class="text--w111-333 fs-36 Regular font-num">-￥{{ parseFloat(integral_price).toFixed(2)
						}}</text>
					</view>
					<view class="cell flex-between-center"
						  v-for="(item, index) in promotions_detail"
						  :key="index"
						  v-show="parseFloat(item.promotions_price)">
						<text class="text--w111-333 fs-28">{{ item.title }}</text>
						<text class="text--w111-333 fs-36 Regular font-num">-￥{{
							parseFloat(item.promotions_price).toFixed(2) }}</text>
					</view>
				</view>
			</view>
			<view class="height-add"></view>
			<view class='fixed-lb w-full bg--w111-fff pb-safe'>
				<!--				<view class="h-80 bg&#45;&#45;w111-FFF0D1 flex-between-center px-20" v-if="!svip_status && svip_price > 0">-->
				<!--					<view class="flex-y-center">-->
				<!--						<image src="@/static/img/vip_leval.png" class="w-36 h-36"></image>-->
				<!--						<view class="pl-8">-->
				<!--							<text class="fs-24 text&#45;&#45;w111-7E4B06">开通 SVIP会员 预计省</text>-->
				<!--							<text class="font-color fs-28">¥{{svip_price}}</text>-->
				<!--							<text class="fs-24 text&#45;&#45;w111-7E4B06">元</text>-->
				<!--						</view>-->
				<!--					</view>-->
				<!--					<view class="fs-24 text&#45;&#45;w111-7E4B06" @click="goPage(1,'/pages/annex/vip_paid/index')">-->
				<!--						<text>立即开通</text>-->
				<!--						<text class="iconfont icon-ic_rightarrow fs-24"></text>-->
				<!--					</view>-->
				<!--				</view>-->
				<view class="bottom-btn pl-32 pr-20 h-96 flex-between-center">
					<view class="agreement fs-mini"
						  v-if="orderGoodsType != 'mall'">
						<text class="l inline-block mb-10"
							  @click="protocol = !protocol">
							<text class="iconfont icon-a-ic_CompleteSelect font-num"
								  v-if="protocol"></text>
							<text class="iconfont icon-ic_unselect text--w111-ccc"
								  v-else></text>
							<text class="ml-12">我已阅读并同意</text>
						</text>
						<text class="font-num"
							  @click="goAgreement('esign_sdk3')">《租赁服务合同》</text>
						<text class="font-num"
							  @click="goAgreement('esign_auth')">《认证服务协议》</text>
						<text class="font-num"
							  @click="goAgreement('esign_digital')">《数字证书服务协议》</text>
						<text class="font-num"
							  @click="goAgreement('esign_privacy')">《隐私政策》</text>
					</view>
					<view class="flex items-baseline">
						<text class="fs-24 fw-500 text--w111-333"
							  v-if="orderGoodsType === 'lease'">首期实付</text>
						<text class="fs-24 fw-500 text--w111-333"
							  v-else>合计</text>
						<baseMoney :money="totalPrice || 0"
								   symbolSize="26"
								   integerSize="44"
								   decimalSize="26"
								   weight></baseMoney>
						<text class="pl-12"
							  v-if="type == 4 && totalIntegral > 0">+{{ totalIntegral }}里程币</text>
					</view>
					<!-- #ifdef MP-ALIPAY -->
					<view class="w-168 h-72 rd-36rpx flex-center text--w111-fff fs-26 bg-gradient z-10"
						  @tap.stop="goPay"
						  v-if="(((valid_count > 0 && !discount_id) || (valid_count == cartInfo.length && discount_id)) && shippingType) || (!shippingType && addressId) || product_type != 0">
						<span v-if="orderGoodsType === 'lease' && !is_super">
							<span v-if="zhimaCheck == depositType.zhima">去免押</span>
							<span v-if="zhimaCheck == depositType.mayi">提交订单</span>
						</span>
						<span v-else-if="orderGoodsType === 'lease' && is_super"> 0元随心租 </span>
						<span v-else>提交订单</span>
					</view>
					<view class="w-168 h-72 rd-36rpx flex-center text--w111-fff fs-26 bg-color-hui"
						  v-else>
						<span v-if="orderGoodsType === 'lease'">去免押</span>
						<span v-else>提交订单</span>
					</view>
					<!-- #endif -->
					<!-- #ifndef MP-ALIPAY -->
					<view @click="orderTip"
						  class="w-168 h-72 rd-36rpx flex-center text--w111-fff fs-26 bg-color-hui">提交订单</view>
					<!-- #endif -->
				</view>
			</view>
		</view>
		<view class="alipaysubmit"
			  v-html="formContent"></view>
		<tuiModal :show="isAddress"
				  title="更新地址"
				  content="当前地址功能已更新，请重新修改"
				  @click="handleClick"
				  @cancel="hideModal"></tuiModal>
		<!-- 赠品抽屉 -->
		<giftDrawer :visible="showGiftDrawer"
					:giveCartInfo="giveCartInfo"
					:giveData="giveData"
					@closeDrawer="closeDrawer"></giftDrawer>
		<couponListWindow :coupon='coupon'
						  @ChangCouponsClone="ChangCouponsClone"
						  :openType='openType'
						  :cartId='cartId'
						  @ChangCoupons="ChangCoupons"
						  @ruleToggle="ruleToggle"></couponListWindow>
		<addressWindow ref="addressWindow"
					   @changeTextareaStatus="changeTextareaStatus"
					   :news='news'
					   :address='address'
					   :pagesUrl="pagesUrl"
					   @OnChangeAddress="OnChangeAddress"
					   @changeClose="changeClose"></addressWindow>
		<invoice-picker :inv-show="invShow"
						:inv-list="invList"
						:inv-checked="invChecked"
						:is-special="special_invoice"
						:url-query="urlQuery"
						@inv-close="invClose"
						@inv-change="invChange"
						@inv-cancel="invCancel">
		</invoice-picker>
		<timeranges :isShow='isShow'
					:time='timeranges'
					@confrim="confrim"
					@cancel="cancels"></timeranges>
		<areaWindow ref="areaWindow"
					:display="display"
					:address='addressInfoArea'
					:cityShow='cityShow'
					@submit="OnAreaAddress"
					@changeClose="changeAddressClose"></areaWindow>
		<installment :instal="instal"
					 :is_super="is_super"
					 :totalPrice="totalPrice"
					 @close="() => { instal.show = false }"></installment>
		<firstRentPay :firstPop="firstPop"
					  :is_super="is_super"
					  :coupon_price="coupon_price"
					  :priceGroup="priceGroup"
					  @close="() => { firstPop.show = false }"></firstRentPay>
	</view>
</template>
<script>
import zhima from '@/mixins/zhima'
import location from "@/mixins/location";
import Routine from '@/libs/routine';
import { appCanGetId } from "@/config/app";
import { bookZfbMsg, goodsType } from "@/tools/goods";
import secondHandTag from "@/components/secondHandTag/index.vue";
const CACHE_CITY = {};
let sysHeight = uni.getSystemInfoSync().statusBarHeight;
import dayjs from '@/plugin/dayjs/dayjs.min.js';
import {
	orderConfirm,
	getCouponsOrderPrice,
	orderCreate,
	postOrderComputed,
	checkShipping, zhimaCreate, oldTradeCreate
} from '@/api/order.js';
import {
	getAddressDefault,
	getAddressDetail,
	invoiceList,
	invoiceOrder,
	getUserInfo, userDataConfig
} from '@/api/user.js';
import { openPaySubscribe } from '@/utils/SubscribeMessage.js';
import {
	storeListApi,
	postCartAdd,
	getCodeData,
	getCollagePartake,
} from '@/api/store.js';
import {
	CACHE_LONGITUDE,
	CACHE_LATITUDE
} from '@/config/cache.js';
import couponListWindow from '@/components/couponListWindow';
import addressWindow from '@/components/addressWindow';
import invoicePicker from '../components/invoicePicker';
import timeranges from '../components/timeranges';
import areaWindow from '@/components/areaWindow';
import giftDrawer from '../components/giftDrawer/index.vue'
import tuiModal from "@/components/tui-modal/index.vue"
import groupGoodsList from "@/components/groupGoodsList/index.vue"
import installment from '../components/installment/index.vue'
import firstRentPay from '../components/firstRentPay/index.vue'
import { toLogin } from '@/libs/login.js';
import { mapGetters } from "vuex";
import auto from '@/mixins/auto'
import colors from "@/mixins/color";
import { HTTP_REQUEST_URL } from '@/config/app';
import { Debounce } from '@/utils/validate.js'
import { bindingAlipayAuth } from "../../../api/public";
import { getExpressTime, tradeCreate } from "../../../api/order";
import moment from "moment/moment";
import { getLightsData, lightsData, lightsDataEvent } from "@/utils/order";
import { lightData } from "@/api/leaseOrder";
export default {
	components: {
		invoicePicker,
		couponListWindow,
		addressWindow,
		timeranges,
		areaWindow,
		giftDrawer,
		tuiModal,
		groupGoodsList,
		installment,
		secondHandTag,
		firstRentPay
	},
	mixins: [auto, colors, location, zhima],
	data() {
		return {
			face_auth_config: 1,//是否需要人脸认证
			relatedIds: [], // 卡项权益
			isStoreSkuCheck: 0, // 是否商品选了门店
			// 系统设置的押金方式
			system_lease_check_type: '',
			// 押金方式枚举
			depositType: {
				all: 0,
				zhima: 1,
				mayi: 2
			},
			zhimaCheck: '', //用户 选择的押金方式
			user: null,
			isVerify: false,
			// 订单类型：租赁，商城
			lease_type: '',
			// 订单商品类型(用于页面判断)
			orderGoodsType: '',
			instal: { show: false, item: { first: 0, rent: 0, num: null } },
			imgHost: HTTP_REQUEST_URL,
			sysHeight: sysHeight,
			addressInfoArea: [],
			cityShow: 2,
			display: false,
			timeranges: [],
			isShow: false,
			giveData: { give_integral: 0, give_coupon: [] },
			giveCartInfo: [],
			confirm: [], //自定义留言
			id: 0,
			isAddress: false,
			textareaStatus: true,
			formContent: '',
			payType: 'alipay', //支付方式
			openType: 1, //优惠券打开方式 1=使用
			active: 0, //支付方式切换
			coupon: { coupon: false, list: [], statusTile: '立即使用' }, //优惠券组件
			address: { address: false }, //地址组件
			addressInfo: {}, //地址信息
			pinkId: 0, //拼团id
			addressId: 0, //地址id
			couponId: 0, //优惠券id
			cartId: '', //购物车id
			type: 0,//活动类型
			activityId: 0,//活动ID
			BargainId: 0,
			combinationId: 0,
			seckillId: 0,
			discountId: 0,
			userInfo: {}, //用户信息
			mark: '', //备注信息
			couponTitle: '请选择', //优惠券
			coupon_price: 0, //优惠券抵扣金额
			promotions_detail: [], //优惠活动金额明细
			useIntegral: false, //是否使用里程币
			integral_price: 0, //里程币抵扣金额
			integral: 0,
			ChangePrice: 0, //使用里程币抵扣变动后的金额
			formIds: [], //收集formid
			status: 0,
			is_address: false,
			shippingType: 0,
			system_store: {},
			storePostage: 0,
			contacts: '',
			contactsTel: '',
			mydata: {},
			storeList: [],
			store_self_mention: 0,
			cartInfo: [],
			priceGroup: {},
			animated: false,
			totalPrice: 0,
			totalIntegral: 0,
			integralRatio: "0",
			pagesUrl: "",
			orderKey: "",
			// usableCoupon: {},
			offlinePostage: "",
			isAuto: false, //没有授权的不会自动授权
			isShowAuth: false, //是否隐藏授权
			from: '',
			news: 1,
			invTitle: '不开发票',
			special_invoice: false,
			invoice_func: false,
			integral_ratio_status: 1,
			header_type: '',
			invShow: false,
			invList: [],
			invChecked: '',
			urlQuery: '',
			pay_close: false,
			noCoupon: 0,
			valid_count: 0,
			discount_id: 0,
			storeId: 0,
			product_type: 1,
			newImg: [],
			isDisplay: '0',
			goodsType: 0,
			timerangesIndex: 0,
			isFocus: false,
			latitude: '',
			longitude: '',
			deviceModel: '',
			site_logo: '',
			range: '',
			showGiftDrawer: false,
			svip_status: false,
			svip_price: 0,
			contactsFocus: false,
			telFocus: false,

			deliveryType: 1,
			product_id: 0,
			shipping_time_limit: '',
			collage_id: 0,
			tableId: 0,
			codeData: {},
			goodsList: [],
			isStore: 0,
			order_id: '',
			is_super: 0,
			orderInfo: {},
			leaseTime: {
				start: '',
				end: '',
				duration: ''
			},
			firstPop: {
				show: false,
				price: {
					firstRent: ''
				}
			},
			checkFirstCoupon: true, // 首次进入订单，默认选中第一张优惠券
			expressInfo: {
				time: '',
				express: ''
			},
			confirmInfo: {},
			buyout_money_end: 0,
			protocol: false,
		};
	},
	computed: {
		...mapGetters(['isLogin']),
		giftCount() {
			let count = 0;
			if (this.giveCartInfo.length) {
				count = this.giveCartInfo.length
			}
			if (this.giveData.give_coupon.length) {
				count = count + this.giveData.give_coupon.length
			}
			if (this.giveData.give_integral > 0) {
				count = count + 1
			}
			return count
		},
		styleType() {
			let obj = this.isDisplay.includes('2') && this.isDisplay.length == 2 && this.deliveryType != 2 ? (this.isDisplay.includes('1') ? 'bg-horn-r' : 'bg-horn') : '';
			return obj
		}
	},
	watch: {
		deliveryType() {
			// 门店自提配送订单，获取用户定位
			if (this.deliveryType == 2 || this.deliveryType == 3) {
				this.getLocation();
			}
		}
	},
	onLoad: function (options) {
		// this.getLocation();
		this.getSystemInfo();
		// #ifdef H5
		this.from = this.$wechat.isWeixin() ? 'weixin' : 'alipay'
		// #endif
		// #ifdef MP
		this.from = 'routine'
		// 桌码
		this.tableId = options.tableId || 0;
		if (this.tableId) {
			this.getCodeData();
		}
		// #endif
		// #ifdef MP-ALIPAY
		this.from = 'ali_routine'
		// #endif

		if (!options.cartId) return this.$util.Tips({
			title: '请选择要购买的商品'
		}, { tab: 3, url: 1 });

		this.deliveryType = options.delivery_type || 1;
		this.isStore = options.is_store ? parseInt(options.is_store) : 0;
		this.storeId = parseInt(options.store_id) || 0;
		if (this.deliveryType == 1 || this.deliveryType == 3) {
			this.addressId = options.addressId || 0;
			this.system_store.name = options.store_name;
		}
		if (this.deliveryType == 2 || this.deliveryType == 3) {
			this.storeId = parseInt(options.store_id) || 0;
			this.system_store.id = parseInt(options.store_id) || 0;
		}
		this.couponId = options.couponId || 0;
		this.noCoupon = parseInt(options.noCoupon) || 0;
		this.product_id = options.product_id || 0;
		this.shipping_time_limit = options.shipping_time_limit || '';
		this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
		this.addressId = options.addressId || 0;
		this.cartId = options.cartId;
		this.is_address = options.is_address ? true : false;
		this.news = !options.new || options.new === '0' ? 0 : 1;
		uni.setStorageSync('news', this.news);
		this.invChecked = options.invoice_id || '';
		this.header_type = options.header_type || '1';
		this.couponTitle = options.couponTitle || '请选择'
		this.luckRecordId = options.luckRecordId || ''
		this.isStoreSkuCheck = options.isStoreSkuCheck || 0
		switch (options.invoice_type) {
			case '1':
				this.invTitle = '增值税电子普通发票';
				break;
			case '2':
				this.invTitle = '增值税电子专用发票';
				break;
		}
		if (options.invoice_name) {
			this.invTitle = options.invoice_name;
		}
		// #ifndef APP-PLUS
		this.textareaStatus = true;
		// #endif
		if (this.isLogin) {
			this.getCheckShipping();
		} else {
			toLogin();
		}
		// #ifdef H5 || MP
		// 拼单
		this.collage_id = options.collage_id || 0;
		if (this.collage_id) {
			this.getCollagePartake();
		}
		// #endif
	},
	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function () {
		let _this = this
		uni.$on('verify', () => { this.getUser(true) })
		uni.$on("activeFn", res => {
			if (res) {
				_this.system_store = res
				_this.storeId = _this.system_store.id
				_this.range = _this.system_store.range
				_this.site_logo = _this.system_store.image
				// _this.cartId = res.cartId
				// _this.news = res.new
				// _this.pinkId = Number(res.pinkId)
				// _this.couponId = res.couponId
				_this.getConfirm()
			}
			// 清除监听
			uni.$off('activeFn');
		})
		let current = (dayjs(new Date(Number(new Date().getTime()))).format('HH:mm')).split(':');
		let currentArray = current;
		currentArray.push(0);
		let arrayNew = [];
		[...currentArray, ...current].forEach(item => {
			arrayNew.push(Number(item))
		})
		this.timeranges = arrayNew;

		this.getaddressInfo()
		// 收货列表
		this.$nextTick(function () {
			this.$refs.addressWindow.getAddressList();
		})
	},
	onUnload() { uni.$off() },
	methods: {
		goAgreement(type) {
			uni.navigateTo({
				url: '/pages/goods/agreement/index?type=' + type
			})
		},
		buyoutEnd() {
			if (this.priceGroup.buyout_final_money > 0) {
				this.buyout_money_end = this.priceGroup.buyout_final_money
			} else {
				this.buyout_money_end = parseFloat(this.priceGroup.buyout_money - this.priceGroup.totalPrice).toFixed(2)
			}
		},
		// 预计快递时间
		getExpressTime(type) {
			// 没有收获地址，租赁时间范围显示实际值
			if (!this.addressId) {
				// 1 自定义
				if (this.confirmInfo.lease_custom_start) {
					this.leaseTime.start = moment(this.confirmInfo.lease_custom_start).format('YYYY-MM-DD')
					this.leaseTime.end = moment(this.confirmInfo.lease_custom_end).format('YYYY-MM-DD')
					this.leaseTime.duration = moment(this.confirmInfo.lease_custom_end).diff(moment(this.confirmInfo.lease_custom_start), 'days') + 1
				} else {
					//  2 固定租期
					//  预计3天发货
					this.leaseTime.start = moment().format('YYYY-MM-DD')
					this.leaseTime.end = moment(this.leaseTime.start).add(this.confirmInfo.priceGroup.lease_days, 'days').format('YYYY-MM-DD')
					this.leaseTime.duration = this.confirmInfo.priceGroup.lease_days
				}

				// 如果用户点了查看快递时间，则提示填写地址
				if (type === 'btn') {
					this.$util.Tips({
						title: '请填写收货地址',
					})
				}
				return
			}


			// 默认发货时间
			// let postTime = moment().format('YYYY-MM-DD') + ' 18:00:00'

			// 默认发货时间
			let now = moment();
			let postTime;
			if (now.hour() >= 18) {
				// 如果当前时间是18点（6点）或之后
				postTime = now.add(1, 'day').hour(18).minute(0).second(0).format('YYYY-MM-DD HH:mm:ss');
			} else {
				// 如果当前时间是18点之前
				postTime = now.hour(18).minute(0).second(0).format('YYYY-MM-DD HH:mm:ss');
			}
			let receiveAddress = {
				province: this.addressInfo.province,
				city: this.addressInfo.city,
				district: this.addressInfo.district,
				address: this.addressInfo.detail
			}
			getExpressTime({
				receiveAddress: JSON.stringify(receiveAddress),
				postTime: postTime,
				address_id: this.addressId,
				product_id: this.product_id,
				shipping_time_limit: this.shipping_time_limit,
				store_id: this.deliveryType == 1 ? 0 : this.system_store.id || 0
			}).then(res => {
				if (res.status === 200) {
					let time = res.data.deliverTime.split(',')[0]
					if (!time) return
					// 几天后
					let nowTime = moment().format('YYYY-MM-DD')
					let expressDays = moment(time).diff(moment(nowTime), 'days')
					let daysList = {
						0: '今天',
						1: '明天',
						2: '后天'
					}
					let days = daysList[expressDays] ? daysList[expressDays] : expressDays + '天后'
					// time是周几 转成中文
					const weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
					let week = moment(time).format('d')
					week = weekList[week]
					// 几点前
					let hour = moment(time).format('HH:mm')
					this.expressInfo.time = `${days}（${week}）${hour}前`
					this.expressInfo.express = res.data.businessTypeDesc

					// 1  自定义时间
					// 开始时间加上快递时间
					// 结束时间加上快递时间
					if (this.confirmInfo.lease_custom_start) {
						this.leaseTime.start = moment(this.confirmInfo.lease_custom_start).add(expressDays, 'days').format('YYYY-MM-DD')
						this.leaseTime.end = moment(this.confirmInfo.lease_custom_end).add(expressDays, 'days').format('YYYY-MM-DD')
						this.leaseTime.duration = moment(this.leaseTime.end).diff(moment(this.leaseTime.start), 'days')
					} else {
						//  2 固定租期
						// 开始时间：今天开始加上快递时间
						// 结束时间：开始时间+租赁天数
						this.leaseTime.start = moment(nowTime).add(expressDays, 'days').format('YYYY-MM-DD')
						this.leaseTime.end = moment(this.leaseTime.start).add(this.confirmInfo.priceGroup.lease_days, 'days').format('YYYY-MM-DD')
						this.leaseTime.duration = this.confirmInfo.priceGroup.lease_days
					}
				}
			})



		},
		getId() {
			let that = this
			Routine.getCode().then(code => {
				bindingAlipayAuth({ code: code }).then(res => {
					if (res.status === 200) {
						that.getUser(true)
					}
				})
			})
		},
		orderTip() {
			this.$util.Tips({
				title: '该功能暂未开放'
			})
		},
		getLocation() {
			this.longitude = uni.getStorageSync("user_longitude"); //经度
			this.latitude = uni.getStorageSync("user_latitude"); //纬度
			uni.getLocation({
				type: 'gcj02',
				success: (res) => {
					try {
						uni.setStorageSync('user_latitude', res.latitude);
						uni.setStorageSync('user_longitude', res.longitude);
						this.longitude = uni.getStorageSync("user_longitude"); //经度
						this.latitude = uni.getStorageSync("user_latitude"); //纬度
						// 获取最新定位后，更新门店列表
						this.getList()
					} catch { }
				}
			});
		},
		getSystemInfo() {
			let _this = this;
			uni.getSystemInfo({
				success: function (info) {
					if (info.deviceModel != undefined) {
						_this.deviceModel = info.deviceModel
					} else if (info.model != undefined) {
						_this.deviceModel = info.model
					}
					console.log('deviceModel', _this.deviceModel);
				}
			});
		},
		getUser(e = false) {
			getUserInfo().then(res => {
				this.user = res.data
				if (e) this.goPay()
			})
		},
		goStore() {
			// 商品详情选了门店，就不能切换
			if (this.isStoreSkuCheck == 1) {
				return
			}

			if (!this.collage_id && !this.isStore) {
				uni.navigateTo({
					url: `/pages/store/list/index?type=1&isCollage=1&storeId=${this.system_store.id}&product_id=${this.product_id}&delivery_type=${this.deliveryType}`
				})
			}
		},
		// 是否显示快递配送
		getCheckShipping() {
			let data = {
				cartId: this.cartId,
				new: this.news
			}
			checkShipping(data).then(res => {
				// 1：快递配送，2：到店自提，3：门店配送
				res.data.type.sort((x, y) => x - y)//正序
				let isDisplay = res.data.type;
				if (this.luckRecordId > 0) {
					this.deliveryType = isDisplay[0];
				}
				if (this.collage_id) {
					isDisplay = [this.deliveryType];
				}
				this.isDisplay = isDisplay;
				if (!this.isDisplay.includes(this.deliveryType)) {
					this.deliveryType = this.isDisplay[0] || '1';
				}
				if (this.deliveryType == '2') {
					this.shippingType = 1;
				} else {
					this.shippingType = 0;
				}
				if (isDisplay.indexOf('2') != -1 || isDisplay.indexOf('3') != -1) {
					this.getConfirm('', 1);
				}
				if (isDisplay.indexOf('1') != -1 || isDisplay.indexOf('3') != -1) {
					// this.getaddressInfo();
					if (isDisplay.indexOf('1') != -1 && isDisplay.length == 1) {
						this.getConfirm();
					}
					// this.$nextTick(function() {
					//  this.$refs.addressWindow.getAddressList();
					// })
				}
			}).catch(err => {
				uni.showToast({
					title: err,
					icon: 'none'
				});
			})
		},
		OnAreaAddress(address) {
			let addr = '';
			if (address.length == 4) {
				addr = address[0].label + '/' + address[1].label + '/' + address[2].label + '/' + address[3].label;
			} else if (address.length == 3) {
				addr = address[0].label + '/' + address[1].label + '/' + address[2].label;
			} else if (address.length == 2) {
				addr = address[0].label + '/' + address[1].label;
			} else {
				addr = address[0].label;
			}
			this.confirm[this.timerangesIndex].value = addr;
			CACHE_CITY[this.timerangesIndex] = address;
		},
		changeRegion(index) {
			if (!this.confirm[index].value) {
				this.addressInfoArea = [];
			}
			this.timerangesIndex = index;
			this.cityShow = Number(this.confirm[index].valConfig.tabVal) + 1;
			this.display = true;
			if (CACHE_CITY[index]) {
				this.addressInfoArea = CACHE_CITY[index];
			}
		},
		// 关闭地址弹窗；
		changeAddressClose: function () {
			this.display = false;
		},
		maskClick(e) {
			console.log(e);
		},
		// 授权关闭
		authColse: function (e) {
			this.isShowAuth = e
		},
		/**
		 * 删除图片
		 *
		 */
		DelPic: function (index, indexs) {
			let that = this,
				pic = this.confirm[index].value;
			that.confirm[index].value.splice(indexs, 1);
			that.$set(that.confirm[index], 'value', that.confirm[index].value);
		},

		/**
		 * 上传文件
		 *
		 */
		uploadpic: function (index) {
			let that = this;
			this.$util.uploadImageOne('upload/image', function (res) {
				that.newImg.push(res.data.url);
				that.$set(that.confirm[index], 'value', that.newImg);
			});
		},
		// 不开发票
		invCancel() {
			this.invChecked = '';
			this.invTitle = '不开发票';
			this.invShow = false;
		},
		// 选择发票
		invChange(id) {
			this.invChecked = id;
			this.invShow = false;
			const result = this.invList.find(item => item.id === id);
			let name = '';
			name += result.header_type === 1 ? '个人' : '企业';
			name += result.type === 1 ? '普通' : '专用';
			name += '发票';
			this.invTitle = name;
		},
		// 关闭发票
		invClose() {
			this.invShow = false;
			this.getInvoiceList()
		},
		getInvoiceList() {
			uni.showLoading({
				title: '正在加载…'
			})
			invoiceList().then(res => {
				uni.hideLoading();
				this.invList = res.data.map(item => {
					item.id = item.id.toString();
					return item;
				});
				const result = this.invList.find(item => item.id == this.invChecked);
				if (result) {
					let name = '';
					name += result.header_type === 1 ? '个人' : '企业';
					name += result.type === 1 ? '普通' : '专用';
					name += '发票';
					this.invTitle = name;
				}
			}).catch(err => {
				uni.showToast({
					title: err,
					icon: 'none'
				});
			});
		},
		/**
		 * 开发票
		 */
		goInvoice: function () {
			this.getInvoiceList()
			this.invShow = true;
			this.urlQuery =
				`new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}`;
		},
		goPay() {
			if (!this.protocol && this.orderGoodsType != 'mall') {
				this.inAnimation = true
				uni.showToast({
					title: '请先阅读并同意《商品租赁服务相关协议》',
					icon: 'none'
				});
				return
			}
			this.formVerify();
		},
		/**
		 * 获取门店列表数据
		 */
		getList: function () {
			let longitude = uni.getStorageSync("user_longitude"); //经度
			let latitude = uni.getStorageSync("user_latitude"); //纬度
			let data = {
				page: 1,
				limit: 100,
				latitude: latitude,
				longitude: longitude,
				is_store: this.deliveryType, //判断是否为到店自提
				product_id: this.product_id,  //判断商品是否适用这个门店
				type: this.seckillId > 0 ? 1 : 0, //商品类型：1是秒杀（有自己单独的适用门店）0是普通
			}
			storeListApi(data).then(res => {
				let list = res.data.list.list || [];
				this.$set(this, 'storeList', list);
				this.$set(this, 'storeId', this.storeId != 0 ? this.storeId : list[0].id);
				list.forEach(item => {
					if (this.storeId == item.id) {
						this.$set(this, 'system_store', item);
						this.range = item.range;
						this.site_logo = item.image;
					}
				})
			}).catch(err => { })

		},
		// 关闭地址弹窗；
		changeClose: function () {
			this.$set(this.address, 'address', false);
		},
		computedPrice: function () {
			let shippingType = this.shippingType;
			postOrderComputed(this.orderKey, {
				addressId: this.addressId,
				useIntegral: this.useIntegral ? 1 : 0,
				couponId: this.priceGroup.couponPrice == 0 ? 0 : this.couponId,
				shipping_type: parseInt(shippingType) + 1,
				payType: this.payType,
				lease_type: this.lease_type
			}).then(res => {
				let result = res.data.result;
				console.log(result.is_super)
				if (result) {
					this.totalPrice = result.pay_price;
					this.totalIntegral = result.pay_integral;
					this.integral_price = result.deduction_price;
					this.coupon_price = result.coupon_price;
					this.promotions_detail = result.promotions_detail;
					this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
					this.is_super = result.is_super;
					this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
					this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
				}
				// 只请求一次
				if (this.checkFirstCoupon) {
					this.getCouponList()
				}
			}).catch(err => {
				return this.$util.Tips({
					title: err
				});
			})
		},
		addressType: function (e, num) {
			//e：0：商城和门店配送 1：门店自提
			//num：配送方式
			this.shippingType = parseInt(e);
			this.deliveryType = num;
			this.getConfirm();
		},
		bindPickerChange: function (e) {
			let value = e.detail.value;
			this.shippingType = value;
			this.computedPrice();
		},
		ChangCouponsClone: function () {
			this.$set(this.coupon, 'coupon', false);
		},
		changeTextareaStatus: function () {
			for (let i = 0, len = this.coupon.list.length; i < len; i++) {
				this.coupon.list[i].use_title = '';
				this.coupon.list[i].is_use = 0;
			}
			this.textareaStatus = true;
			this.status = 0;
			this.$set(this.coupon, 'list', this.coupon.list);
		},
		/**
		 * 处理点击优惠券后的事件
		 *
		 */
		ChangCoupons: function (index) {
			let list = this.coupon.list;
			if (list[index].is_use) {
				list[index].use_title = '';
				list[index].is_use = 0;
				this.couponTitle = '请选择';
				this.couponId = 0;
			} else {
				list[index].use_title = '不使用';
				list[index].is_use = 1;
				this.couponTitle = list[index].title;
				this.couponId = list[index].id;
			}
			this.$set(this.coupon, 'coupon', false);
			this.$set(this.coupon, 'list', list);
			this.getConfirm(1);
		},
		ruleToggle(index) {
			this.coupon.list[index].ruleshow = !this.coupon.list[index].ruleshow;
		},
		/**
		 * 使用里程币抵扣
		 */
		ChangeIntegral: function () {
			this.useIntegral = !this.useIntegral;
			this.computedPrice();
		},
		/**
		 * 选择地址后改变事件
		 * @param object e
		 */
		OnChangeAddress: function (e) {
			this.textareaStatus = true;
			this.addressId = e;
			this.address.address = false;
			this.getConfirm();
			// this.getaddressInfo();
			this.computedPrice();
		},
		bindHideKeyboard: function (e) {
			this.mark = e.detail.value;
		},
		// 对象转数组
		objToArr(data) {
			let obj = Object.keys(data);
			let m = obj.map(key => data[key]);
			return m;
		},
		/**
		 * 获取当前订单详细信息
		 *
		 */
		getConfirm(numType, num) {
			this.getUser()
			let that = this;
			let shippingType = parseInt(this.shippingType) + 1;
			let addressId = 0, storeid;
			if (this.deliveryType == 1) {
				addressId = that.addressId
				storeid = 0
			} else if (this.deliveryType == 2) {
				storeid = that.storeId
				addressId = ''
			} else {
				storeid = that.storeId
				addressId = that.addressId
			}
			// // 门店自提配送订单，获取用户定位
			// if(this.deliveryType==2||this.deliveryType==3){
			//   this.getLocation();
			// }
			uni.showLoading({
				title: '加载中',
				mask: true
			})
			orderConfirm(
				that.cartId, that.news, addressId, shippingType, storeid, that.couponId, that.luckRecordId
			).then(res => {
				if (res.data.upgrade_addr == 1) {
					that.id = res.data.addressInfo.id
					this.isAddress = true
				}
				if (numType != 1) {
					let confirm = this.objToArr(res.data.custom_form);
					confirm.forEach((item, index, arr) => {
						CACHE_CITY[index] = ''; //清空省市区
						if (item.name == 'texts') {
							if (item.defaultValConfig.value) {
								item.value = item.defaultValConfig.value
							} else {
								item.value = ''
							}
						} else if (item.name == 'radios') {
							item.value = item.wordsConfig.list[0].val
						} else if (item.name == 'uploadPicture') {
							item.value = [];
						} else if (item.name == 'dateranges') {
							if (item.valConfig.tabVal == 0) {
								if (item.valConfig.tabData == 0) {
									let obj = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
									item.value = [obj, obj]
								} else {
									let data1 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[0]).getTime()))).format('YYYY-MM-DD');
									let data2 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[1]).getTime()))).format('YYYY-MM-DD');
									item.value = [data1, data2];
								}
							} else {
								item.value = [];
							}
						} else {
							if (['times', 'dates', 'timeranges'].indexOf(item.name) != -1) {
								if (item.valConfig.tabVal == 0) {
									if (item.valConfig.tabData == 0) {
										if (item.name == 'times') {
											item.value = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
										} else if (item.name == 'dates') {
											item.value = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
										} else {
											let current = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
											item.value = current + ' - ' + current;
										}
									} else {
										if (item.name == 'times' || item.name == 'dates') {
											item.value = item.valConfig.specifyDate;
										} else {
											item.value = item.valConfig.specifyDate[0] + ' - ' + item.valConfig.specifyDate[1];
										}
									}
								} else {
									item.value = '';
								}
							} else {
								item.value = '';
							}
						}
					})
					function sortNumber(a, b) {
						return a.timestamp - b.timestamp;
					}
					confirm.sort(sortNumber);
					that.$set(that, 'confirm', confirm);
				}
				// 是否需要人脸
				that.face_auth_config = res.data.face_auth_config;

				// 订单类型：租赁，商城
				that.$set(that, 'lease_type', res.data.lease_type);
				// 订单商品类型(用于页面判断)
				this.orderGoodsType = goodsType[res.data.lease_type]
				that.$set(that, 'goodsType', res.data.type);
				that.$set(that, 'userInfo', res.data.userInfo);
				that.$set(that, 'integral', res.data.userInfo.integral);
				that.$set(that, 'integralRatio', res.data.integralRatio);
				that.$set(that, 'offlinePostage', res.data.offlinePostage);
				that.$set(that, 'orderKey', res.data.orderKey);
				that.$set(that, 'valid_count', res.data.valid_count);
				that.$set(that, 'discount_id', res.data.discount_id)
				that.$set(that, 'priceGroup', res.data.priceGroup);
				that.instal.item = {
					rent: res.data.priceGroup.rent,
					num: res.data.priceGroup.rent_num,
					list: res.data.installment_list,
					priceGroup: res.data.priceGroup,
				}
				that.firstPop.price = {
					firstRent: res.data.priceGroup.first_rent
				}
				// 卡项权益
				this.relatedIds = []
				res.data.priceGroup.related.forEach(item => {
					this.relatedIds.push(item.id)
				})

				// 到期买断尾款
				this.buyoutEnd()
				// this.buyout_money_end = parseFloat(this.priceGroup.buyout_money - this.priceGroup.totalPrice).toFixed(2)
				// console.log('=========到期买断尾款=>',this.buyout_money_end)
				that.$set(that, 'type', parseInt(res.data.type));
				that.$set(that, 'activityId', parseInt(res.data.activityId));
				that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
				that.$set(that, 'BargainId', parseInt(res.data.bargain_id));
				that.$set(that, 'combinationId', parseInt(res.data.combination_id));
				that.$set(that, 'discountId', parseInt(res.data.discount_id));
				that.$set(that, 'invoice_func', res.data.invoice_func);
				that.$set(that, 'integral_ratio_status', res.data.integral_ratio_status);
				that.$set(that, 'special_invoice', res.data.special_invoice);
				that.$set(that, 'store_self_mention', res.data.store_self_mention);
				that.$set(that, 'svip_status', res.data.svip_status);
				that.$set(that, 'svip_price', res.data.svip_price);
				// that.$set(that, 'contacts', res.data.userInfo.real_name);
				// that.$set(that, 'contactsTel', res.data.userInfo.record_pone);
				that.giveData.give_integral = res.data.give_integral;
				that.giveData.give_coupon = res.data.give_coupon;
				let cartInfo = res.data.cartInfo;
				let cartObj = [], giftObj = [];
				cartInfo.forEach(item => {
					if (item.is_gift == 1) {
						giftObj.push(item)
					} else {
						cartObj.push(item)
					}
				})
				that.$set(that, 'cartInfo', cartObj);
				that.$set(that, 'giveCartInfo', giftObj);
				let giveType = -1;
				giftObj.forEach(item => {
					if (item.product_type == 0) {
						return giveType = 0
					}
				})
				that.$set(that, 'product_type', (res.data.product_type == 0 || giveType == 0 || res.data.product_type == 4) ? 0 : 1);
				that.$set(that, 'ChangePrice', that.totalPrice);
				// that.getCouponList();
				that.computedPrice();
				if (this.addressId || this.couponId) {
					// this.computedPrice();
				} else {
					that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
						parseFloat(res.data
							.priceGroup.storePostage)));
				}
				if (num) {
					this.getList();
				}

				//   租赁时间范围
				this.confirmInfo = res.data

				// 这里只请求一次：请求地址，后续计算快递时间
				// if(!this.leaseTime.duration){
				// this.getaddressInfo();
				// }

				// 默认押金方式
				if (this.orderGoodsType === 'lease') {
					this.system_lease_check_type = res.data.lease_check_type
					switch (this.system_lease_check_type) {
						case 0:
							this.zhimaCheck = this.depositType.zhima
							break
						case 1:
							this.zhimaCheck = this.depositType.zhima
							break
						case 2:
							this.zhimaCheck = this.depositType.mayi
							break
					}
				}
			}).catch(err => {
				return this.$util.Tips({
					title: err
				});
			}).finally(() => {
				uni.hideLoading()
			})
		},
		/**
		 * 获取当前金额可用优惠券
		 *
		 */
		getCouponList: function () {
			// 优惠券列表只获取一次，默认选择第一张优惠券
			let that = this;
			let data = {
				lease_type: this.lease_type,
				pay_price: this.totalPrice, // 首期实付
				cartId: this.cartId,
				'new': this.news,
				shipping_type: that.$util.$h.Add(that.shippingType, 1),
				store_id: (that.system_store && this.deliveryType != 1) ? that.system_store.id : 0
			};
			getCouponsOrderPrice(this.totalPrice, data).then(res => {
				res.data.map(item => {
					this.$set(item, 'ruleshow', false);
				})
				that.$set(that.coupon, 'list', res.data);
				that.openType = 1;

				// 首次进入订单，默认选中第一张优惠券
				that.checkFirstCoupon = false
				if (that.coupon.list.length > 0) {
					that.ChangCoupons(0)
				}
			})
		},
		/*
		 * 获取默认收货地址或者获取某条地址信息
		 */
		getaddressInfo: function () {
			console.log("dizhi")
			let that = this;
			if (that.addressId) {
				getAddressDetail(that.addressId).then(res => {
					res.data.is_default = parseInt(res.data.is_default);
					that.addressInfo = res.data || {};
					that.addressId = res.data.id || 0;
					that.address.addressId = res.data.id || 0;
					that.getExpressTime()
				})
			} else {
				getAddressDefault().then(res => {
					res.data.is_default = parseInt(res.data.is_default);
					that.addressInfo = res.data || {};
					that.addressId = res.data.id || 0;
					that.address.addressId = res.data.id || 0;
					that.getExpressTime()
				})
			}
		},
		showMaoLocation(e) {
			let self = this;
			// #ifdef H5
			if (self.$wechat.isWeixin()) {
				self.$wechat.seeLocation({
					latitude: Number(e.latitude),
					longitude: Number(e.longitude),
					name: e.name,
					scale: 13,
					address: `${e.address}-${e.detailed_address}`,
				}).then(res => { })
			} else {
				// #endif	
				uni.openLocation({
					latitude: Number(e.latitude),
					longitude: Number(e.longitude),
					name: e.name,
					address: `${e.address}-${e.detailed_address}`,
					success: function () {
						Number
					}
				});
				// #ifdef H5	
			}
			// #endif
		},
		couponTap: function () {
			this.coupon.coupon = true;
			this.coupon.list.forEach((item, index) => {
				if (item.id == this.couponId) {
					item.is_use = 1
				} else {
					item.is_use = 0
				}
			})
			this.$set(this.coupon, 'list', this.coupon.list);
		},
		car: function () {
			let that = this;
			that.animated = false;
		},
		onAddress: function (name) {
			let that = this;
			// 当前有默认地址，则点击选择其他地址
			if (name) {
				that.textareaStatus = false;
				that.address.address = true;
				that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this.cartId +
					'&pinkId=' +
					this.pinkId +
					'&couponId=' +
					this.couponId +
					'&store_id=' +
					this.storeId;
			} else {
				// 反之，去新增地址
				uni.navigateTo({
					url: '/pages/users/user_address/index?new=' + this.news + '&cartId=' + this.cartId + '&pinkId=' +
						this.pinkId + '&couponId=' + this.couponId + '&store_id=' + this.storeId
				})
			}
		},
		// 芝麻免押结果
		zhimaResult() {
			uni.showLoading({
				title: '加载中...'
			});
			setTimeout(() => {
				uni.hideLoading()
				// 跳转结果页
				uni.redirectTo({
					url: `/pages/goods/lease_order_result/index?order_id=${this.order_id}`
				})
			}, 1000)
		},

		// 创建芝麻免押订单
		// zhimaCreate(){
		//   zhimaCreate({
		//     oid:this.orderInfo.oid
		//   }).then(res=>{
		//     uni.hideLoading()
		//     if(res.status===200){
		//       my.tradePay({
		//         orderStr: res.data.orderStr, // 完整的支付参数拼接成的字符串，从 alipay.fund.auth.order.app.freeze 接口获取
		//         complete: (res) => {
		//           if(res.resultCode === '9000') {
		//             // this.$util.Tips({ title: '免押成功'})
		//           } else {
		//             // this.$util.Tips({ title: '免押失败' })
		//           }
		//           // uni.redirectTo({
		//           //   url: `/pages/goods/lease_order_details/index?order_id=${this.order_id}`
		//           // })
		//
		//           // 延迟跳转订单结果页，因为芝麻免押有延迟
		//           uni.showLoading({
		//             title: '加载中...'
		//           });
		//           setTimeout(()=>{
		//             uni.hideLoading()
		//             // 跳转结果页
		//             uni.redirectTo({
		//               url: `/pages/goods/lease_order_result/index?order_id=${this.order_id}`
		//             })
		//           },1000)
		//         }
		//       });
		//     }
		//   }).catch(err => {
		//     this.$util.Tips({
		//       title: err.msg,
		//       icon: 'error'
		//     });
		//     uni.hideLoading()
		//   })
		// },

		// 创建订单
		payment(data) {
			let that = this;
			uni.showLoading({
				title: '订单创建中'
			});
			orderCreate(that.orderKey, data).then(async (res) => {
				this.order_id = res.data.result.order_id || res.data.result.orderId
				if (res.data.result.oid) {
					this.orderInfo = res.data.result
				}

				if (this.is_super > 0) {//至尊会员订单
					uni.redirectTo({
						url: `/pages/goods/lease_order_details/index?order_id=${this.order_id}`
					})
					return
				}
				// #ifdef MP-ALIPAY
				//   租赁
				if (this.lease_type === 1) {
					// uni.hideLoading();
					// 押金方式2:蚂蚁链直接下单
					if (this.zhimaCheck == this.depositType.mayi) {
						uni.redirectTo({
							url: `/pages/goods/lease_order_details/index?order_id=${this.order_id}`
						})
					}
					// 押金方式1: 前置免押
					// 1,创建交易组件  2，唤起去免押
					if (this.zhimaCheck == this.depositType.zhima) {


						// 芝麻免押
						this.zhimaCreatePre(this.orderInfo.oid)

						// my.checkBeforeAddOrder({
						//   success({ requireOrder, sceneId, sourceId }) {
						//     tradeCreate({
						//       oid:that.orderInfo.oid,
						//       source_id: sourceId,
						//       path:'pages/goods/lease_order_details/index'
						//     }).then(res=>{
						//       if(res.status===200){
						//         // 唤起去免押
						//         // that.zhimaCreate()
						//         that.zhimaCreate(that.orderInfo.oid)
						//       }
						//     })
						//   },
						//   fail({ error, errorMessage }) {
						//     that.$util.Tips({ title: '订单前置判断失败'})
						//   },
						//   complete(e) {
						//     // console.log(e)
						//   },
						// })
					}
					return
				}
				// #endif
				//   商城
				if (this.lease_type === 2) {
					// // 1. 订单前置判断接口获取 sourceId
					const { requireOrder, sceneId, sourceId } = await new Promise((resolve, reject) => {
						my.checkBeforeAddOrder({
							success: resolve,
							fail: reject
						});
					});
					console.log('===交易组件：商城===>1，前置查询')

					const tradeRes = await oldTradeCreate({
						oid: that.orderInfo.oid,
						source_id: sourceId,
						path: 'pages/goods/lease_order_details/index'
					})

					uni.hideLoading();
					uni.redirectTo({
						url: `/pages/goods/cashier/index?order_id=${res.data.result.order_id}&from_type=order`
					})
				}
			}).catch(err => {
				uni.hideLoading();
				return that.$util.Tips({
					title: err
				});
			}).finally((res) => {
				// 渠道推广：下单成功回传
				// let lightParams=getApp().globalData.lightParams
				if (getApp().globalData.biz_no && this.orderInfo.oid) {
					let params = {
						biz_no: getApp().globalData.biz_no,
						oid: this.orderInfo.oid
					}
					getLightsData(params)
				}
			})
		},
		userAuto() { // 身份验证
			uni.hideLoading();
			let store_id = this.deliveryType == 1 ? 0 : this.system_store.id || 0
			uni.navigateTo({ url: `/pages/users/user_auth/index?orderKey=${this.orderKey}&store_id=${store_id}` })
		},
		verifyOk() {
			this.isVerify = true
			this.goPay()
			// setTimeout(() => {
			// 	this.isVerify = true
			// 	this.goPay()
			// }, 1500)
		},
		clickTextArea() {
			this.$refs.textarea.focus()
		},
		bindDateChange: function (e, index) {
			this.confirm[index].value = e.target.value
		},
		bindTimeChange: function (e, index) {
			this.confirm[index].value = e.target.value
		},
		bindSelectChange: function (e, index, item) {
			this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
		},
		getTimeranges(index) {
			this.isShow = true
			this.timerangesIndex = index
		},
		confrim(e) {
			this.isShow = false;
			this.confirm[this.timerangesIndex].value = e.time;
			let arrayNew = [];
			e.val.forEach(item => {
				arrayNew.push(Number(item))
			})
			this.timeranges = arrayNew;
		},
		cancels() {
			this.isShow = false;
		},
		// 单选
		radioChange(e, index, item) {
			this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
		},
		// 多选
		checkboxChange(e, index, item) {
			let obj = e.detail.value;
			let val = '';
			item.wordsConfig.list.forEach((j, jindex) => {
				obj.forEach(x => {
					if (jindex == x) {
						val = val + (val ? ',' : '') + j.val;
					}
				})
			})
			this.confirm[index].value = val
		},
		formVerify() {
			let that = this;
			if (that.tableId) {
				return this.SubOrder();
			}
			// && !that.shippingType
			if (!that.addressId && !that.product_type) return that.$util.Tips({
				title: '请选择收货地址'
			});
			// 自提
			if (this.deliveryType == 2) {
				// 自动填充自提人信息
				that.contacts = that.addressInfo.real_name
				that.contactsTel = that.addressInfo.phone
			}
			// if (that.shippingType == 1) {
			// if (that.contacts == "" || that.contactsTel == "") {
			//   return that.$util.Tips({
			//     title: '请填写联系人或联系人电话'
			//   });
			// }
			// if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
			//   return that.$util.Tips({
			//     title: '请填写正确的手机号'
			//   });
			// }
			// if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(that.contacts)) {
			//   return that.$util.Tips({
			//     title: '请填写您的真实姓名'
			//   });
			// }
			// if (that.storeList.length == 0) return that.$util.Tips({
			//   title: '暂无门店,请选择其他方式'
			// });
			// }
			for (var i = 0; i < that.confirm.length; i++) {
				let data = that.confirm[i]
				if (['radios'].indexOf(data.name) == -1 && (data.titleShow.val || (['uploadPicture', 'dateranges'].indexOf(data.name) == -1 && data.value && data.value.trim()))) {
					if ((data.name === 'texts' && data.valConfig.tabVal == 0) || ['dates', 'times', 'selects', 'citys', 'checkboxs'].indexOf(data.name) != -1) {
						if (!data.value || (data.value && !data.value.trim())) {
							return that.$util.Tips({
								title: `请填写${data.titleConfig.value}`
							});
						}
					}
					if (data.name === 'timeranges') {
						if (!data.value) {
							return that.$util.Tips({
								title: `请选择${data.titleConfig.value}`
							});
						}
					}
					if (data.name === 'dateranges') {
						if (!data.value.length) {
							return that.$util.Tips({
								title: `请选择${data.titleConfig.value}`
							});
						}
					}
					if (data.name === 'texts' && data.valConfig.tabVal == 4) {
						if (data.value <= 0) {
							return that.$util.Tips({
								title: `请填写大于0的${data.titleConfig.value}`
							});
						}
					}
					if (data.name === 'texts' && data.valConfig.tabVal == 3) {
						if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
							return that.$util.Tips({
								title: `请填写正确的${data.titleConfig.value}`
							});
						}
					}
					if (data.name === 'texts' && data.valConfig.tabVal == 1) {
						if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
							return that.$util.Tips({
								title: `请填写正确的${data.titleConfig.value}`
							});
						}
					}

					if (data.name === 'texts' && data.valConfig.tabVal == 2) {
						if (!
							/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i
								.test(data.value)) {
							return that.$util.Tips({
								title: `请填写正确的${data.titleConfig.value}`
							});
						}
					}

					if (data.name === 'uploadPicture') {
						if (!data.value.length) {
							return that.$util.Tips({
								title: `请上传${data.titleConfig.value}`
							});
						}
					}
				}
			}
			if (this.type == 4 && this.totalIntegral > this.userInfo.integral) {
				return that.$util.Tips({
					title: '您的里程币不足以抵扣本单里程币金额'
				});
			}
			this.SubOrder();
		},
		SubOrder(e) {
			if (this.lease_type === 1) {
				this.SubOrderLease(e)
			} else if (this.lease_type === 2) {
				this.SubOrderMall(e)
			}
		},
		// 提交商城订单
		SubOrderMall(e) {
			// 有隐私权限接口
			// if(appCanGetId){
			//   if(this.user.is_complete===0){
			//     this.getId()
			//     return
			//   }
			// }

			let that = this, data = {};
			// uni.getSystemInfo({
			//   success: function (info) {
			//     console.log('平台：' + info);
			//   }
			// });
			data = {
				staff_id: getApp().globalData.spid || '',
				cno: getApp().globalData.cno,
				tag: getApp().globalData.tag,
				lease_type: this.lease_type,
				collate_code_id: that.collage_id || that.tableId,
				custom_form: that.confirm,
				real_name: that.contacts,
				phone: that.contactsTel,
				addressId: that.addressId,
				formId: '',
				couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
				payType: that.payType,
				useIntegral: that.useIntegral,
				bargainId: that.BargainId,
				combinationId: that.combinationId,
				discountId: that.discountId,
				pinkId: that.pinkId,
				is_super: that.is_super,
				seckill_id: that.seckillId,
				mark: that.mark,
				store_id: that.deliveryType == 1 ? 0 : that.system_store.id || 0,
				'from': that.from,
				shipping_type: that.tableId ? 4 : that.$util.$h.Add(that.shippingType, 1),  // 桌码订单为：4
				'new': that.news,
				'invoice_id': that.invChecked,
				// #ifdef H5
				quitUrl: location.protocol + '//' + location.hostname +
					'/pages/goods/order_pay_status/index?' +
					'&type=3' + '&totalPrice=' + this.totalPrice
          // #endif
          // #ifdef APP-PLUS
          quitUrl: '/pages/goods/order_details/index'
				// #endif
			};
			uni.showLoading({
				title: '订单支付中'
			});
			// #ifdef MP
			openPaySubscribe().then(() => {
				that.payment(data);
			});
			// #endif
			// #ifndef MP
			that.payment(data);
			// #endif
		},
		SubOrderLease(e) {
			// 有隐私权限
			// if(appCanGetId){
			//   if(this.user.is_complete===0){
			//     this.getId()
			//     return
			//   }
			// }else{
			// }
			if (!this.user.real_name && !this.user.card_id) return this.userAuto()

			// let verify = await this.getVerifyCheck(this.orderKey)
			// if(!verify) return this.getVerifyUser(this.orderKey)

			if (this.user.real_name) {
				if (this.deliveryType != 2 && this.addressInfo.real_name != this.user.real_name) {
					return this.$util.Tips({ title: `收货人请用【${this.user.real_name}】` })
				}
			}
			// 人脸识别配置：
			//zyl 20250618 人脸认证统一移到下单后,此处隐藏
			// if(this.face_auth_config==1 && !this.isVerify) return this.getVerifyUser(this.orderKey)

			let that = this, data = {};
			data = {
				staff_id: getApp().globalData.spid || '',
				related_id: this.relatedIds.join(','),
				cno: getApp().globalData.cno,
				tag: getApp().globalData.tag,
				check_type: this.zhimaCheck,
				deviceModel: this.deviceModel,
				latitude: this.latitude,
				longitude: this.longitude,
				lease_type: this.lease_type,
				collate_code_id: that.collage_id || that.tableId,
				custom_form: that.confirm,
				real_name: that.contacts,
				phone: that.contactsTel,
				addressId: that.addressId,
				formId: '',
				couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
				is_super: that.is_super,
				payType: that.payType,
				useIntegral: that.useIntegral,
				bargainId: that.BargainId,
				combinationId: that.combinationId,
				discountId: that.discountId,
				pinkId: that.pinkId,
				seckill_id: that.seckillId,
				mark: that.mark,
				store_id: that.deliveryType == 1 ? 0 : that.system_store.id || 0,
				'from': that.from,
				shipping_type: that.tableId ? 4 : that.$util.$h.Add(that.shippingType, 1),  // 桌码订单为：4
				'new': that.news,
				'invoice_id': that.invChecked,
				// #ifdef H5
				quitUrl: location.protocol + '//' + location.hostname +
					'/pages/goods/order_pay_status/index?' +
					'&type=3' + '&totalPrice=' + this.totalPrice
					// #endif
					// #ifdef APP-PLUS
					quitUrl: '/pages/goods/order_details/index'
				// #endif
			};
			// uni.showLoading({ title: '订单支付中' });
			// #ifdef MP
			openPaySubscribe().then(() => {
				that.payment(data);
			});
			// #endif
			// #ifndef MP
			that.payment(data);
			// #endif
		},
		// 去详情页
		goDetail(id) {
			uni.navigateTo({
				url: `/pages/goods_details/index?id=${id}&fromType=1`
			});
		},
		addCart(type, item) {
			if (type == 1) {
				if (item.productInfo.stock == item.cart_num) return this.$util.Tips({
					title: '该产品没有更多库存了！'
				});
				item.cart_num++
			} else {
				if (item.cart_num == 1) return
				item.cart_num--
			}
			let data = {
				cartNum: item.cart_num,
				new: this.news,
				uniqueId: item.product_attr_unique,
				productId: item.productInfo.id,
				key: this.news ? item.id : '',
				is_set: 1
			};
			postCartAdd(data).then(res => {
				this.getConfirm();
				setTimeout(() => {
					this.computedPrice();
				}, 500)
			}).catch(err => {
				return this.$util.Tips({
					title: err
				});
			});
		},
		setValue: Debounce(function (e, item) {
			let num = e.detail.value;
			if (item.productInfo.limit_num > 0 && num > item.productInfo.limit_num) {
				item.cart_num = item.productInfo.limit_num;
				return this.$util.Tips({
					title: '购物车数量不能大于限购数量'
				});
			}
			let data = {
				cartNum: num,
				new: this.news,
				uniqueId: item.product_attr_unique,
				productId: item.productInfo.id,
				key: this.news ? this.cartId : '',
				is_set: 1
			};
			postCartAdd(data).then(res => {
				this.getConfirm();
				setTimeout(() => {
					this.computedPrice();
				}, 500)
			}).catch(err => {
				return this.$util.Tips({
					title: err
				});
			});
		}),
		goPage(type, url) {
			if (type == 1) {
				uni.navigateTo({
					url
				})
			} else if (type == 2) {
				uni.switchTab({
					url
				})
			} else if (type == 3) {
				uni.navigateBack();
			}

		},
		closeDrawer() {
			this.showGiftDrawer = false;
		},
		hideModal() {
			this.isAddress = false;
		},
		handleClick(e) {
			let index = e.index;
			if (index == 1) {
				uni.navigateTo({
					url: '/pages/users/user_address/index?id=' + this.id + '&new=' + this.news + '&cartId=' + this.cartId + '&pinkId=' + this.pinkId + '&couponId=' + this.couponId
				})
			}
			this.isAddress = false;
		},
		clearInput(type) {
			if (type == 0) {
				this.contacts = '';
				this.contactsFocus = true;
			} else {
				this.contactsTel = '';
				this.telFocus = true;
			}
		},
		getCodeData() {
			getCodeData({
				tableId: this.tableId
			}).then(res => {
				this.codeData = res.data;
			});
		},
		getCollagePartake() {
			getCollagePartake({
				collage_id: this.collage_id
			}).then(res => {
				this.goodsList = res.data;
			});
		}
	}
}
</script>
<style lang="scss"
	scoped>
	/deep/.uni-date-x--border {
		border: 0;
	}

	///deep/.uni-icons{
	//	font-size: 0 !important;
	//}
	/deep/.uni-date-x {
		color: #999;
		font-size: 15px;
	}

	/deep/.uni-date__x-input {
		font-size: 15px;
	}

	.footer-box {
		position: fixed;
		bottom: 12rpx;
		bottom: calc(12rpx + constant(safe-area-inset-bottom));
		bottom: calc(12rpx + env(safe-area-inset-bottom));
		z-index: 5;
		right: 20rpx;
		width: 168rpx;
		height: 72rpx;
		text-align: center;
		line-height: 72rpx;
		font-size: 26rpx;
		color: #fff;
		border-radius: 36rpx;
		background-color: var(--view-theme);
	}

	.height-add {
		height: calc(176rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
		height: calc(176rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
	}

	/deep/uni-checkbox[disabled] .uni-checkbox-input {
		background-color: #eee;
	}

	.alipaysubmit {
		display: none;
	}

	.abs-lt .active-card {
		&:after {
			right: -67rpx;
		}
	}

	.abs-ct .active-card {
		&:after {
			right: -67rpx;
		}

		&:before {
			left: -67rpx;
			transform: scaleX(-1);
		}
	}

	.abs-rt .active-card {
		&:after {
			left: -67rpx;
			-moz-transform: scaleX(-1);
			-webkit-transform: scaleX(-1);
			-o-transform: scaleX(-1);
			transform: scaleX(-1);
		}
	}

	.active-card {

		&:after,
		&:before {
			content: "";
			width: 67rpx;
			height: 76rpx;
			background-image: url('../static/nav_circle_left.png');
			background-size: contain;
			background-repeat: no-repeat;
			position: absolute;
			bottom: 0;
			z-index: 4;
		}

	}

	.line {
		width: 680rpx;
		margin: auto;
		height: 3rpx;
	}

	.line image {
		width: 100%;
		height: 100%;
		display: block;
	}

	.address {
		background-color: #fff;
		box-sizing: border-box;

		.default {
			width: 60rpx;
			height: 34rpx;
			background: var(--view-minorColorT);
			border-radius: 8rpx;
			color: var(--view-theme);
			font-size: 22rpx;
		}
	}

	.add1 {
		padding: 24rpx 20rpx 32rpx 32rpx;
	}

	.add2 {
		padding: 36rpx 20rpx 0 32rpx;
	}

	.footer .transparent {
		opacity: 0
	}

	._map {
		width: 188rpx;
		height: 104rpx;
		background-size: 100%;
		background-repeat: no-repeat;
	}

	.store_distance {
		position: absolute;
		top: -4rpx;
		left: 30rpx;
		width: 130rpx;
		height: 36rpx;
		box-shadow: 0px 0px 16rpx 0px rgba(0, 0, 0, 0.0784);
	}

	.store-horn {
		position: absolute;
		top: 32rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 0;
		height: 0;
		border-top: 6rpx solid #fff;
		border-right: 6rpx solid transparent;
		border-left: 6rpx solid transparent;
	}

	.store_logo {
		position: absolute;
		top: 40rpx;
		left: 68rpx;
		width: 52rpx;
		height: 52rpx;
		box-shadow: 0px 0px 16rpx 0px rgba(0, 0, 0, 0.0784);
		padding: 6rpx;

		&:after {
			content: '';
			position: absolute;
			bottom: -8rpx;
			left: 50%;
			transform: translateX(-50%);
			width: 0;
			height: 0;
			border-top: 8rpx solid #fff;
			border-right: 6rpx solid transparent;
			border-left: 6rpx solid transparent;
		}

		&:before {
			content: '';
			position: absolute;
			bottom: -12rpx;
			left: 50%;
			transform: translateX(-50%);
			width: 6rpx;
			height: 6rpx;
			border-radius: 50%;
			background-color: var(--view-theme);
		}
	}

	.dashed-b {
		border-bottom: 1px dashed #eee;
	}

	.w-322 {
		width: 322rpx;
	}

	.w-450 {
		width: 450rpx;
	}

	.order_goods~.order_goods {
		margin-top: 32rpx;
	}

	.other>.cell {
		padding: 12px;
		margin-top: 0 !important;
	}

	.cell input {
		width: 450rpx;
		text-align: right;
	}

	.cell .radio {
		margin: 0 22rpx;
		padding: 10rpx 0;
	}

	.cell~.cell {
		margin-top: 40rpx;
	}

	.SemiBold {
		font-family: SemiBold;
	}

	.Regular {
		font-family: 'Regular';
	}

	.placeholder {
		color: #ccc;
	}

	.asterisk {
		position: absolute;
		color: red;
		left: 0;
	}

	.gradient-box {
		background: linear-gradient(180deg, var(--view-theme) 0%, var(--view-theme) 52%, rgba(233, 51, 35, 0) 100%);
	}

	.h-auto {
		height: auto;
	}

	.bg-primary-light {
		background: var(--view-minorColorT);
	}

	.bg-horn {
		position: relative;

		&:before {
			position: absolute;
			content: '';
			width: 20rpx;
			height: 20rpx;
			background-color: var(--view-minorColorT);
			left: 0;
			bottom: -20rpx;
		}

		&::after {
			position: absolute;
			content: '';
			width: 20rpx;
			height: 20rpx;
			background-color: #fff;
			left: 0;
			bottom: -20rpx;
			border-radius: 20rpx 0 0 0;
		}
	}

	.bg-horn-r {
		position: relative;

		&:before {
			position: absolute;
			content: '';
			width: 20rpx;
			height: 20rpx;
			background-color: var(--view-minorColorT);
			right: 0;
			bottom: -20rpx;
		}

		&::after {
			position: absolute;
			content: '';
			width: 20rpx;
			height: 20rpx;
			background-color: #fff;
			right: 0;
			bottom: -20rpx;
			border-radius: 0 20rpx 0 0;
		}
	}

	.rd-lt-24rpx {
		border-radius: 24rpx 0 0 0;
	}

	.rd-rt-24rpx {
		border-radius: 0 24rpx 0 0;
	}

	.z-2 {
		z-index: 2;
	}

	.gold {
		color: #DCA658;
	}

	.over {
		width: 104rpx;
		height: 104rpx;
		border-radius: 50%;
		background-color: rgba(51, 51, 51, 0.6);
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	.con-border {
		border: 1px solid var(--view-theme);
	}

	.clear-btn {
		border-radius: 0 12rpx 0 12rpx;
	}

	.header {
		padding: 32rpx;
		border-radius: 24rpx;
		margin: 20rpx;
		background: #FFFFFF;
		font-size: 24rpx;
		line-height: 34rpx;
		color: #999999;

		.top {
			margin-bottom: 12rpx;
		}

		.name {
			flex: 1;
			min-width: 0;
			font-weight: 500;
			font-size: 30rpx;
			line-height: 42rpx;
			color: #333333;
		}

		.number {
			font-size: 22rpx;
			line-height: 42rpx;
			color: #333333;
		}

		.light {
			font-weight: 500;
			font-size: 30rpx;
			color: var(--view-theme);
		}
	}

	.dining {
		height: 100rpx;
		padding: 0 24rpx 0 32rpx;
		border-radius: 24rpx;
		margin: 20rpx;
		background: #FFFFFF;
		font-size: 24rpx;
		color: #333333;

		.total {
			font-weight: 500;
			font-size: 30rpx;
			color: #3D3D3D;
		}
	}

	.dinner {
		border-radius: 24rpx;
		margin: 20rpx;
		background: #FFFFFF;

		.head {
			padding: 35rpx 24rpx;
			font-size: 28rpx;
			color: #333333;

			.image {
				display: block;
				width: 36rpx;
				height: 36rpx;
				border-radius: 50%;
			}

			.name {
				flex: 1;
				min-width: 0;
				padding: 0 10rpx;
			}
		}

		.body {
			padding: 0 24rpx 32rpx;
		}

		.item {
			position: relative;
			margin-top: 32rpx;

			&:first-child {
				margin-top: 0;
			}

			&.gray {
				background-color: #EEEEEE;
			}

			.image {
				display: block;
				width: 136rpx;
				height: 136rpx;
				border-radius: 16rpx;
			}

			.text {
				flex: 1;
				min-width: 0;
				padding: 0 20rpx;
			}

			.name {
				font-size: 28rpx;
				line-height: 40rpx;
				color: #333333;
			}

			.attr {
				margin-top: 12rpx;
				font-size: 24rpx;
				line-height: 34rpx;
				color: #999999;
			}

			.number {
				margin-top: 10rpx;
				text-align: right;
				font-size: 24rpx;
				line-height: 34rpx;
				color: #999999;
			}
		}
	}

	.border-top {
		.flex-1 {
			position: relative;
			min-width: 0;

			&::before {
				content: "";
				position: absolute;
				top: 0;
				left: 0;
				bottom: 0;
				border-left: 1rpx solid #EEEEEE;
				transform: rotateZ(360deg);
			}

			&:first-child {
				padding-right: 28rpx;

				&::before {
					display: none;
				}
			}
		}
	}

	.collapse-box {
		/deep/.uni-collapse-item__title-wrap {
			text-align: right;
			margin-bottom: 10rpx;
		}

		/deep/.uni-collapse-item__title-arrow {
			margin-right: 0 !important;
			margin-top: -10rpx !important;
		}

		/deep/.uni-collapse-item__wrap-content {
			border: none !important;
		}
	}

	.line-text {
		color: #999;
		margin: 0 4rpx;
	}

	.lease-area {

		.l,
		.r {
			display: flex;
			align-items: center;

			.tag {
				//  渐变色
				background: linear-gradient(120deg, #e04b53 50%, #fafafa 100%);
				width: 42rpx;
				height: 42rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				color: #fff;
				border-radius: 50%;
				margin-right: 6rpx;
			}

			.txt {
				color: #e04b53;
				font-weight: bold;
			}

			.tag2 {
				background: linear-gradient(120deg, #4884dc 50%, #fafafa 100%);
			}

			.txt2 {
				color: #4884dc;
			}
		}

		.c {
			padding: 1px;
			border-radius: 40rpx;
			//  渐变色
			background: linear-gradient(120deg, #e04b53 30%, #4884dc 100%);

			.c-day {
				background: #fff;
				border-radius: 40rpx;
				padding: 4rpx 20rpx;
			}

			.c-line-l,
			.c-line-r {
				width: 30rpx;
				height: 1rpx;
				background: #e04b53;
				position: absolute;
				top: 50%;
				border-radius: 1rpx;
			}

			.c-line-l {
				left: -30rpx;
			}

			.c-line-r {
				background: #4884dc;
				right: -30rpx;
			}
		}
	}

	.first-pay {
		position: absolute;
		top: 0;
		left: 0;
		padding-left: 25rpx;
		padding-right: 25rpx;
		height: 100rpx;
		background: #f4f8fb;
		display: flex;
		justify-content: space-between;
		width: 100%;
	}

	.plan-time {
		background: #fff;

		.r {
			.time {
				color: #1ba035;
				margin-bottom: 5px;
			}

			.exp {}
		}

		.express-tip {
			padding: 10rpx 20rpx;
			border-radius: 30rpx;
			color: #fff;
			background: #1ba035;
		}
	}

	.add-wrap {}

	.zhima-wrap {
		.zhima-wrap-tit {
			font-size: 30rpx;
			font-weight: bold;
			margin-bottom: 24rpx;
			color: #333;
		}

		.top-tip {
			position: absolute;
			top: -1rpx;
			right: -1rpx;
			font-size: 20rpx;
			padding: 8rpx 10rpx;
			background: #1677ff;
			color: #fff;
			border-bottom-left-radius: 20rpx;
			line-height: 1;
		}

		.zhima-tip {
			padding: 2rpx;
			font-size: 20rpx;
			color: #999;
			margin-top: 10rpx;
			white-space: nowrap;
		}

		.check {
			background: #e7f1ff;
			border-color: #1677ff !important;
		}

		.zhima-wrap-main {
			display: flex;
			justify-content: space-around;

			.l,
			.r {
				width: 48%;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding: 20rpx 0;
				border-radius: 20rpx;
				border: 1rpx solid #ddd;
			}

			.l {
				position: relative;
				overflow: hidden;

				.ebao-iconfont {
					font-size: 58rpx;
					color: #1677FF;
					margin-bottom: 12rpx;
				}
			}

			.r {
				.ebao-color {
					font-size: 58rpx;
					margin-bottom: 14rpx;
				}
			}
		}

		.zhima-wrap-main-single {

			.zhima-single,
			.mayi-single {
				display: flex;
				align-items: center;
				justify-content: center;
				padding: 30rpx 20rpx;
				border-radius: 20rpx;
				border: 1rpx solid #ddd;

				.zhima-tip {
					font-size: 22rpx;
				}
			}

			.zhima-single {
				position: relative;
				overflow: hidden;

				.ebao-iconfont {
					font-size: 80rpx;
					color: #1677FF;
				}

				.zhima-single-r {
					margin-left: 18rpx;
				}
			}

			.mayi-single {
				padding: 36rpx 20rpx;

				.ebao-color {
					font-size: 66rpx;
				}

				.mayi-single-r {
					margin-left: 26rpx;
				}
			}
		}
	}

	.card-item {
		flex: 1;

		.price {
			text-align: right;
		}
	}

	.card-listn {
		white-space: nowrap;
		overflow: auto;
		width: 100%;

		.card-itemn {
			display: inline-flex;
			align-items: center;
			width: 350rpx;
			margin-right: 20rpx;
			background: #f5f4f9;
			padding: 20rpx;
			border-radius: 28rpx;

			.l {
				flex: 0 0 100rpx;
				height: 100rpx;
				margin-right: 16rpx;
			}

			.r {
				text-align: left;

				.r-1 {
					width: 200rpx;
					font-size: 32rpx;
					color: #333;
					margin-bottom: 20rpx;
				}

				.r-2 {
					font-size: 26rpx;
				}
			}
		}
	}

	.bottom-btn {
		position: relative;

		.agreement {
			position: absolute;
			top: -80%;
			left: 0;
			background: #fff;
			width: 100%;
			padding: 10rpx 30rpx;
			//display: flex;
			//align-items: center;
			//flex-wrap: wrap;
			//overflow-x: auto;
			word-break: break-all;

			.l {
				.iconfont {
					font-size: 26rpx;
				}

				//display: inline-flex;
				//align-items: center;
			}

			>view {
				//flex: 0 0 auto;
			}
		}
	}
</style>
